Skip to content

ci(auto-release): dispatch release.yml instead of pushing tag - #4

Merged
llcro merged 1 commit into
mainfrom
fix/auto-release-chain
Apr 23, 2026
Merged

ci(auto-release): dispatch release.yml instead of pushing tag#4
llcro merged 1 commit into
mainfrom
fix/auto-release-chain

Conversation

@llcro

@llcro llcro commented Apr 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fix the silent failure in the auto-release.ymlrelease.yml chain. Tag pushes authenticated by GITHUB_TOKEN do not trigger downstream workflows (GitHub's recursion-prevention rule), so a version bump merge would create the vX.Y.Z tag on the remote but never produce a release. Discovered during the v1.1.1 cut — the tag landed, but release.yml never fired, so the release had to be re-cut manually by deleting the remote tag and re-pushing it under a human's credentials.

The fix: stop creating the tag in this workflow. Instead, gh workflow run release.yml -f version=X.Y.Z --ref $GITHUB_SHA. release.yml already has a workflow_dispatch code path that creates the tag itself, and since it's the running workflow at that point rather than a downstream trigger, the recursion block doesn't apply.

Changes

  • Replace git tag + git push origin $TAG with gh workflow run release.yml.
  • Pin the dispatch to $GITHUB_SHA (the exact version-bump commit) so the Cargo.toml-vs-tag validation in release.yml is guaranteed to pass even if main advances between auto-release firing and the dispatch.
  • Check tag existence via the GitHub API (gh api repos/.../git/refs/tags/$TAG) rather than git rev-parse on the local clone — the API is authoritative for "has this release already been cut".
  • Tighten permissions: contents: writecontents: read, add actions: write (needed by gh workflow run).

Why not use a PAT instead?

A PAT on the tag push would also work (GITHUB_TOKEN recursion block doesn't apply to PATs), but it adds secret management overhead and a rotation surface. The dispatch approach keeps everything within the default GITHUB_TOKEN and shrinks the blast radius.

Test plan

  • Merge, then at the next real version bump: confirm auto-release fires, dispatches release.yml, and a release is cut end-to-end.
  • Belt-and-braces fallback preserved: manual tag push from a developer's credentials still triggers release.yml normally.

Tag pushes authenticated by GITHUB_TOKEN do not trigger downstream
workflows (GitHub's recursion-prevention rule), which silently breaks the
Cargo.toml bump -> auto-release -> release.yml chain. The tag ends up on
the remote but no binaries build.

Switch to dispatching release.yml directly. The release workflow already
supports workflow_dispatch and creates the tag itself in that path, so
there is no downstream trigger to be blocked. Pin the dispatch to
GITHUB_SHA so the release is cut from the exact commit that bumped
Cargo.toml, guaranteeing the tag/Cargo.toml validation in release.yml
passes even if main advances in the interim.

- Remove `git tag`/`git push` from this workflow; downgrade permissions
  from contents:write to contents:read + actions:write.
- Check tag existence via the GitHub API rather than the local clone;
  the API is authoritative for 'has this release already been cut'.
@llcro
llcro merged commit d5199b9 into main Apr 23, 2026
8 checks passed
@llcro
llcro deleted the fix/auto-release-chain branch April 23, 2026 14:34
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