Interview Prep/GitHub Actions/Deployments, Environments & Releases

`Branch "feature/login" is not allowed to deploy to prod due to environment protection rules.`

BeginnerTroubleshootingDeployments, Environments & Releases
Answer

Likely causes → Working as designed: the prod environment only allows main and release tags, and someone dispatched from a feature branch.

Diagnose →

gh api repos/ORG/REPO/environments/prod/deployment-branch-policies --jq '.branch_policies[].name'

Fix → Merge to main and deploy from there or via a release tag.

Prevent → Restrict the workflow_dispatch UI documentation to say "run from main".

All GitHub Actions questions Roadmap: GitHub Actions

More on Deployments, Environments & Releases