Skip to content

Enforce PR promotion path: * -> dev and dev -> main only#8

Merged
dwego merged 2 commits into
mainfrom
copilot/dev-only-pull-requests
Jul 15, 2026
Merged

Enforce PR promotion path: * -> dev and dev -> main only#8
dwego merged 2 commits into
mainfrom
copilot/dev-only-pull-requests

Conversation

Copilot AI commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

This change enforces a strict branch promotion flow in pull requests: any feature branch can target dev, and only dev can target main. PRs outside this path are blocked at workflow level.

  • Policy enforcement workflow

    • Added .github/workflows/pr-branch-policy.yml on pull_request events.
    • Validates base.ref and head.ref combinations:
      • allow: * -> dev
      • allow: dev -> main
      • deny: all other source/target pairs
  • Security hardening

    • Added explicit workflow token restriction with permissions: {} since the job only reads PR metadata.
permissions: {}

if [ "$BASE_REF" = "dev" ]; then
  exit 0
fi

if [ "$BASE_REF" = "main" ] && [ "$HEAD_REF" = "dev" ]; then
  exit 0
fi

exit 1

@dwego dwego marked this pull request as ready for review July 15, 2026 04:06
@dwego dwego merged commit 8ce9dd6 into main Jul 15, 2026
0 of 2 checks passed
@dwego dwego deleted the copilot/dev-only-pull-requests branch July 15, 2026 04:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants