github / github/branch-deploy

Deployment protection rules for issue comment trigger

Offen
#388 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
question
Vorherrschende Sprache
TypeScript
Sterne
576
Forks
74
Ø Merge
11 Std. 7 Min.
Gemergte PRs (30 T.)
1

Beschreibung

### 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?

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
github-actions
Bereich
ci-cd, devops
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Ruhig
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.