Skip to content

ci: forward GH_TOKEN instead of inheriting all secrets - #325

Merged
northword merged 1 commit into
mainfrom
ci/forward-gh-token
Nov 7, 2026
Merged

northword merged 1 commit into
mainfrom
ci/forward-gh-token

Conversation

@northword

Copy link
Copy Markdown
Collaborator

Closes #320.

release-plugin.yml declares exactly one caller secret, the optional GH_TOKEN, and reads it as secrets.GH_TOKEN || secrets.GITHUB_TOKEN. The automatic GITHUB_TOKEN already reaches the called workflow without being passed, so secrets: inherit only ever forwarded GH_TOKEN while also handing every other secret of the generated plugin repo to the callee.

-    secrets: inherit
+    secrets:
+      GH_TOKEN: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
  • Repos without a GH_TOKEN secret: the value falls back to the built-in GITHUB_TOKEN, so the release keeps working (GH_TOKEN is required: false, and an empty secret does not fail the run).
  • Repos that set GH_TOKEN to a PAT keep the override.
  • GITHUB_TOKEN permissions are unchanged: the caller's permissions block (contents/issues/pull-requests: write) still caps the token, and a caller cannot pass a secret name the callee does not declare — hence the key is GH_TOKEN, not GITHUB_TOKEN.

Also drops the secrets-inherit finding from zizmor for every repo generated from the template.

The release-plugin.yml@main ref is intentionally left untouched.

`release-plugin.yml` declares exactly one caller secret: the optional
`GH_TOKEN` (used as `secrets.GH_TOKEN || secrets.GITHUB_TOKEN`). The
automatic `GITHUB_TOKEN` reaches the called workflow without being passed,
so `secrets: inherit` only ever forwarded `GH_TOKEN` while handing every
other secret of the consumer repo to the callee as well.

Forward that one secret explicitly and keep the built-in token as the
fallback, so behaviour is unchanged for repos without a `GH_TOKEN` and
repos that set one still get the override.

Fixes #320
@northword
northword merged commit e46add3 into main Nov 7, 2026
3 checks passed
@northword
northword deleted the ci/forward-gh-token branch November 7, 2026 17:15
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.

release.yml: pass GH_TOKEN explicitly instead of secrets: inherit

1 participant