Skip to content

Commit

Permalink
ci(protect-main-branch): fix branch verification
Browse files Browse the repository at this point in the history
  • Loading branch information
Mario Pinto committed Jan 16, 2025
1 parent a0b024a commit d25250d
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions .github/workflows/block-pr-to-main-from-not-develop.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,13 @@ on:
jobs:
block-pr-to-main-from-not-develop:
runs-on: ubuntu-latest
if:
(
github.event.pull_request.head.ref != 'develop' &&
github.event.pull_request.base.ref == 'main'
) ||
(
github.event.pull_request.head.ref == 'main' &&
github.event.pull_request.base.ref == 'develop'
)
if: |
(github.event.pull_request.head.ref != 'develop' && github.event.pull_request.base.ref == 'main') ||
(github.event.pull_request.head.ref == 'main' && github.event.pull_request.base.ref == 'develop')
steps:
- name: Check branch name
run: |
if [ $GITHUB_HEAD_REF != "develop" ]; then
echo "Pull request not allowed from branch $GITHUB_HEAD_REF to main."
if [ "${{ github.event.pull_request.head.ref }}" != "develop" ]; then
echo "Pull request not allowed from branch ${{ github.event.pull_request.head.ref }} to main."
exit 1
fi
fi

0 comments on commit d25250d

Please sign in to comment.