Skip to content

fix(release): pre-create the tag via refs API so GITHUB_TOKEN can publish - #478

Merged
githubrobbi merged 1 commit into
mainfrom
ci/release-tag-precreate-no-target
Jun 26, 2026
Merged

fix(release): pre-create the tag via refs API so GITHUB_TOKEN can publish#478
githubrobbi merged 1 commit into
mainfrom
ci/release-tag-precreate-no-target

Conversation

@githubrobbi

@githubrobbi githubrobbi commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Problem

The v0.6.14 release (run #135) failed at the publish step:

👩‍🏭 Creating new GitHub release for tag v0.6.14 using commit "ce5abac…"
⚠️ GitHub release failed with status: 403
{"message":"Resource not accessible by integration", …}

All three binaries built fine — only action-gh-release's POST /releases 403'd. Root cause (confirmed via cli/cli#9514): creating a release with a commit-SHA target_commitish under the GITHUB_TOKEN integration now returns "Resource not accessible by integration" (began ~2026-06; PATs are unaffected, which is exactly why the bot fails but a user token succeeds). Repo/org settings, workflow permissions (token had Contents: write), and rulesets were all verified permissive — it's the API endpoint, not config.

Fix (no PAT — eliminates the failure mode, doesn't defer it)

Split tag creation from release creation:

  1. Create the tag ref at the built commit via POST /git/refs — not subject to the workflow-file push guard that rejects git push origin $TAG (run #24795626228), and a plain contents:write op rather than the release-with-target endpoint that 403s.
  2. action-gh-release attaches the release to the now-existing tag with no target_commitish → sidesteps the cli#9514 403.

Why this over a PAT:

  • No secret to mint, rotate, or leak — a fine-grained PAT expires and re-introduces this exact silent breakage in N months.
  • Least privilege — keeps the auto-scoped, per-run GITHUB_TOKEN.
  • No double-release — a GITHUB_TOKEN-created tag doesn't re-trigger this push: tags: v* workflow (a PAT-pushed tag would).
  • Build-commit pinning preserved — we tag inputs.commit_sha directly.
  • Idempotent — skips tag creation if it already exists (re-run / tag-push path).

After merge

Re-dispatch release.yml for v0.6.14 (workflow_dispatch, commit ce5abac) to publish the full 45-asset release via the real pipeline.

@githubrobbi
githubrobbi enabled auto-merge June 26, 2026 13:57
…lish

The v0.6.14 release (run #135) failed: action-gh-release's `POST /releases`
with a commit-SHA `target_commitish` now returns 403 "Resource not
accessible by integration" under the GITHUB_TOKEN integration (cli/cli#9514;
began ~2026-06, PATs unaffected — which is why the bot fails but a user
token succeeds). All three binaries built fine; only the publish step 403'd.

Fix without introducing a PAT (no secret to mint, rotate, or leak; keeps
the least-privilege auto-scoped GITHUB_TOKEN): create the tag ref ourselves
at the exact built commit via `POST /git/refs`, then have action-gh-release
attach the release to the now-existing tag with NO `target_commitish`. That
threads both server-side guards — the refs API is not subject to the
workflow-file push guard that rejects `git push origin $TAG` (run
A GITHUB_TOKEN-created tag also does not re-trigger this `push: tags: v*`
workflow, so there is no double-release. Build-commit pinning is preserved
because we tag `inputs.commit_sha` directly. Idempotent on re-runs (skips
when the tag already exists).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@githubrobbi
githubrobbi force-pushed the ci/release-tag-precreate-no-target branch from 2f7bea3 to d511012 Compare June 26, 2026 14:02
@githubrobbi
githubrobbi added this pull request to the merge queue Jun 26, 2026
Merged via the queue into main with commit 73fec9b Jun 26, 2026
26 checks passed
@githubrobbi
githubrobbi deleted the ci/release-tag-precreate-no-target branch June 26, 2026 14:31
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