Skip to content

Restrict Production/Release dispatch to main#124

Open
bschwedler wants to merge 1 commit into
mainfrom
ci/restrict-production-to-main
Open

Restrict Production/Release dispatch to main#124
bschwedler wants to merge 1 commit into
mainfrom
ci/restrict-production-to-main

Conversation

@bschwedler

Copy link
Copy Markdown
Contributor

Manually dispatching Production or Release from a non-main branch runs the full build, or for Release, opens a release PR, with no ref check — Production only skips the final push step, and Release has no guard at all.

Adds a main-only gate job backed by this repo's production GitHub environment, now restricted to the main branch. build/release depend on it via needs:, so an off-main dispatch fails immediately instead of burning CI time or mutating repo state from the wrong ref.

This lives in its own job because a job that uses: a reusable workflow can't also carry environment:.

Add a main-only gate job so manually dispatching Production or
Release from a non-main branch fails immediately instead of running
a full build, or, for Release, branching and opening a release PR
off the wrong ref.

Reusable-workflow caller jobs (uses:) can't carry `environment:`
directly, so the check lives in its own job that build/release
depend on via needs:. The production GitHub environment in this
repo now has a branch policy restricting deploys to main.
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.

1 participant