Deployment protection rules for issue comment trigger
- Dominant language
- TypeScript
- Stars
- 576
- Forks
- 74
- Avg merge
- 11h 7m
- Merged PRs (30d)
- 1
Description
### Details
Hi,
Trying to use deployment protection rules in GitHub for setting restrictions on that you must have a branch named "release/*" for example to deploy to production. The problem is using [environment](https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idenvironment) when deploying in a PR with branch deploy you get the error:
> Branch "main" is not allowed to deploy to dev due to environment protection rules.
This is because when triggering the workflow on issue_comment it runs on the main branch and therefore the deployment protection rule does not work.
Happen to know a solution to this or do we have to develop our own deployment protection in the workflow?
Contributor guide
Research direction
Start by tracing the issue_comment workflow and how it selects the deployment ref before applying the environment protection rules. Confirm how GitHub Actions evaluates the branch for deployments triggered from issue comments, then define a supported way for the deployment to use the intended pull request or branch context. Done means the protection rule correctly permits or rejects the deployment based on that context.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github-actions
- Domain
- ci-cd, devops
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100