Final files #6
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: Restrict PRs to main | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
restrict-pr: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check if source branch is allowed | |
run: | | |
ALLOWED_BRANCHES=("testing") | |
SOURCE_BRANCH=$(echo "${{ github.event.pull_request.head.ref }}") | |
if [[ ! " ${ALLOWED_BRANCHES[@]} " =~ " ${SOURCE_BRANCH} " ]]; then | |
echo "Pull requests to 'main' can only come from 'testing'." | |
exit 1 | |
fi |