Feat/geat10 wf #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Pull Request Checks | |
on: | |
pull_request: | |
branches: | |
- main | |
- release-please--branches--main | |
jobs: | |
check_pr_closure: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check if PR title contains 'release' | |
if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true | |
# if: github.event.pull_request.merged == true | |
id: check_title | |
run: | | |
title=$(jq -r .pull_request.title $GITHUB_EVENT_PATH) | |
if [[ "$title" == *"release"* ]]; then | |
echo "PR title contains 'release'." | |
approved_users=("username1") # List of approved GitHub usernames | |
user=$(jq -r .pull_request.user.login $GITHUB_EVENT_PATH) | |
if [[ ! " ${approved_users[@]} " =~ " $user " ]]; then | |
echo "Not authorized to close PR with 'release' title." | |
exit 1 | |
fi | |
fi |