Skip to content

Commit

Permalink
Add Github action to validate PR source branch
Browse files Browse the repository at this point in the history
This commit introduces a new Github Action workflow that checks the source branch of pull requests. The action ensures that only changes from the "next" branch can enter the "prod" branch.
  • Loading branch information
Cliftonz committed Jun 4, 2024
1 parent f978012 commit 2349867
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/on-pr-change.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Check pull request source branch
on:
pull_request_target:
types:
- opened
- reopened
- synchronize
- edited
jobs:
check-branches:
runs-on: ubuntu-latest
steps:
- name: Check branches
run: |
if [ ${{ github.head_ref }} != "next" ] && [ ${{ github.base_ref }} == "prod" ]; then
echo "Merge requests to prod branch are only allowed from next branch."
exit 1
fi

Check failure

Code scanning / CodeQL

Expression injection in Actions Critical

Potential injection from the ${{ github.head_ref }}, which may be controlled by an external user.

0 comments on commit 2349867

Please sign in to comment.