Skip to content

[ECO-2116] Add a branch protection rule to only allow merging to production from main #4

[ECO-2116] Add a branch protection rule to only allow merging to production from main

[ECO-2116] Add a branch protection rule to only allow merging to production from main #4

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