Skip to content

Commit 8f2fae7

Browse files
authored
docs: channel branches need environment deployment-branch allowances (#106)
When the publish job runs in a GitHub Environment with deployment branch restrictions (our recommended hardening restricts it to `main`), prerelease channel branches can't enter the environment β€” with trusted publishing this means OIDC token requests are rejected and channel publishes fail. Adds reminders in both places users would hit this: - **docs/prereleases.md** β€” setup step 3 (adding the channel branch to the release workflow) now calls out updating the environment's allowed deployment branches. - **docs/github-actions.md** β€” the "restrict deployment branches to `main`" hardening bullet now notes channel branches must be added to the allowed list.
1 parent 3124ce7 commit 8f2fae7

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

β€Ždocs/github-actions.mdβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ That's it β€” the `publish` environment auto-creates on the first publish run, s
211211

212212
If you create the environment manually in repo Settings β†’ Environments _before_ the first publish, you can attach protection rules:
213213

214-
- **Restrict deployment branches to `main`** β€” recommended. Cheap defense in depth: non-`main` refs can never request an OIDC token from this environment, even if a workflow trigger is accidentally widened later.
214+
- **Restrict deployment branches to `main`** β€” recommended. Cheap defense in depth: non-`main` refs can never request an OIDC token from this environment, even if a workflow trigger is accidentally widened later. If you use [prerelease channels](prereleases.md), also add each channel branch (e.g. `next`) to the allowed list β€” otherwise channel publishes fail when the job can't enter the environment.
215215
- **Required reviewers** β€” optional. Adds a manual approval gate before each publish. Usually redundant if `npmStaged: true` is enabled (below), since you already have a 2FA approval gate on npmjs.com.
216216

217217
**Recommended publish config** β€” enable provenance and staged publishing for maximum security:

β€Ždocs/prereleases.mdβ€Ž

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ on:
137137
138138
That's the only workflow change. `bumpy ci release` reads the current branch, looks up the channel in `_config.json`, and behaves accordingly.
139139

140+
> **If your publish job runs in a GitHub Environment with deployment branch restrictions** (the [recommended hardening](github-actions.md#optional-hardening-protection-rules-on-the-publish-environment) restricts it to `main`), add each channel branch to the environment's allowed deployment branches (repo Settings β†’ Environments β†’ publish β†’ Deployment branches). Otherwise the publish job can't run from the channel branch β€” with npm trusted publishing this means OIDC token requests are rejected and channel publishes fail.
141+
140142
> Make sure the checkout step uses `fetch-depth: 0` (the [release workflow](github-actions.md) already requires this) β€” the channel publish trigger diffs the triggering push to detect release PR merges.
141143

142144
> The PR check workflow (`bumpy-check.yaml`) needs no changes β€” it runs on `pull_request_target` and handles any base branch.

0 commit comments

Comments
Β (0)