How do deployment branch policies interact with tags and `workflow_dispatch`?
AdvancedConceptSecrets, Variables, Environments & Permissions
Answer
The policy checks github.ref of the run against the allowed patterns. A workflow_dispatch from a feature branch targeting prod is rejected with "Branch 'feature/x' is not allowed to deploy to prod due to environment protection rules." Tag patterns must be added explicitly with type tag; allowing only main blocks a release workflow triggered by v1.4.0.
gh api -X POST repos/ORG/REPO/environments/prod/deployment-branch-policies \
-f name='v*' -f type=tag
More on Secrets, Variables, Environments & Permissions
Where can secrets be defined, and what is the precedence?BeginnerHow are secrets protected in transit and in logs, and what are the limits?IntermediateAre secrets available to every step automatically?BeginnerWhy is it a bad idea to store structured data like JSON or a whole `.env` file as one secret?IntermediateWhat is an environment, and which protection rules can it have?BeginnerWhen does a job wait for environment approval, and what does the reviewer see?Intermediate