Skip to content

Check PR Branch

Check PR Branch #6

Workflow file for this run

name: Check PR Branch
run-name: Check PR Branch
on:
pull_request:
types: [opened, edited, synchronize]
jobs:
Check-PR-Branch:
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
steps:
- name: Check Branch
run: |
if [[ ${{ github.head_ref }} != 'staging' && ${{ github.base_ref }} == 'main' ]]
then
echo "Pushing to main branch is not allowed."
exit 1
fi
- name: Add PR Comment
if: failure()
uses: mshick/add-pr-comment@v2
with:
message: 'Only `staging` can push to `main`. Please adjust your base (target) branch.'