Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

Gate signing and host OIDC through the release environment (#4415)

Maximilian Roos4702e1481aa2
diff --git a/.github/AGENTS.md b/.github/AGENTS.md
index e7279b98e..ef453ca04 100644
--- a/.github/AGENTS.md
+++ b/.github/AGENTS.md
@@ -9,13 +9,11 @@ worktrunk-bot is a PAT-backed GitHub user with write access. Only the repo owner
## Tokens and environments
- tend admits main and holds CLAUDE_CODE_OAUTH_TOKEN and TEND_BOT_TOKEN.
-- release admits tags and holds AUR_SSH_PRIVATE_KEY and TEND_BOT_TOKEN.
-- signing admits tags and holds SIGNPATH_API_TOKEN.
+- release admits tags and holds AUR_SSH_PRIVATE_KEY, TEND_BOT_TOKEN, and SIGNPATH_API_TOKEN; it also gates packslip signing and crates.io Trusted Publishing through OIDC.
- github-pages admits main and uses OIDC without a stored secret.
- CODECOV_TOKEN is a repo secret allowlisted for coverage upload.
-- crates.io uses Trusted Publishing through release, not a stored token.
-A job naming an environment can read all its secrets. The branch and tag policies are therefore security gates: do not broaden them to make a workflow run. Tag environments admit every tag because the Tag operations ruleset controls creation and movement. tend and release each hold TEND_BOT_TOKEN because their admitted refs differ.
+A job naming an environment can reference all its secrets through the secrets context; pass each secret only to the step that needs it. Signing and publishing share release because their ref gates are the same. The branch and tag policies are security gates: do not broaden them to make a workflow run. Tag environments admit every tag because the Tag operations ruleset controls creation and movement. tend and release each hold TEND_BOT_TOKEN because their admitted refs differ.
Generated tend workflows use environment {name: tend, deployment: false}. The deployment flag prevents pull_request_target runs from creating misleading deployment records on PRs. Edit the generator or its config, not generated tend-*.yaml files.
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index 658253abf..c7e11321f 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -119,13 +119,11 @@ jobs:
matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }}
runs-on: ${{ matrix.runner }}
container: ${{ matrix.container && matrix.container.image || null }}
- # This job doesn't deploy anything; the environment scopes
- # SIGNPATH_API_TOKEN so it isn't readable by every workflow the repo runs.
- # It is deliberately not `release`, which also holds the publish
- # credentials — see .github/AGENTS.md. The policy admits tags only, so
- # setting `pr-run-mode = "upload"` in dist-workspace.toml would make GitHub
- # reject this job on a PR ref.
- environment: signing
+ # Signing and publishing share the admin-controlled tag gate. Pass each
+ # credential only to the step that uses it; see .github/AGENTS.md.
+ # The tag-only policy rejects this job on PR refs if dist-workspace.toml
+ # sets `pr-run-mode = "upload"`.
+ environment: release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json
@@ -314,6 +312,8 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
runs-on: "ubuntu-24.04"
# id-token and attestations are for the packslip step below.
+ # Gate OIDC on admin-controlled tags, alongside the other release jobs.
+ environment: release
permissions:
contents: write
id-token: write