[ECO-2116] Add a branch protection rule to only allow merging to production
from main
#4
Workflow file for this run
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: 'Production Branch Protection' | |
on: | |
pull_request: | |
types: [opened, reopened, synchronize, edited] | |
jobs: | |
production-branch-protection: | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Check if the PR is targeting the production branch" | |
id: check_branch | |
if: github.base_ref == 'production' && github.head_ref != 'main' | |
run: | | |
echo "ERROR: You can only merge to the `production` branch from `main`." | |
exit 1 |