Skip to content

Fail the auto-tag job when a release can't be tagged - #10

Merged
jamiewest merged 1 commit into
mainfrom
ci/auto-tag-fail-loudly
Sep 21, 2026
Merged

jamiewest merged 1 commit into
mainfrom
ci/auto-tag-fail-loudly

Conversation

@jamiewest

Copy link
Copy Markdown
Owner

The bug

auto-tag.yml handled a missing RELEASE_PAT with echo "::warning::…"; continue, so the job exited 0 and the run showed green while no tag was pushed and nothing published.

That is not hypothetical — it has been happening since the release plumbing landed:

repo pub.dev
extensions 0.8.1 0.7.1
extensions_flutter 0.6.0 0.5.2

The repo has zero tags. extensions 0.8.0 was merged on 2026-08-31, never published, and has now been superseded by 0.8.1 without ever shipping. Both "Auto-tag releases" runs — 33446064509 (0.8.0) and 35623011460 (0.8.1) — report success. From the latter's log:

##[warning]extensions 0.8.1 is unpublished but RELEASE_PAT is not set.
##[warning]extensions_flutter 0.6.0 is unpublished but RELEASE_PAT is not set.

Warnings on a green run are invisible in practice. A release that silently doesn't happen is worse than one that fails.

The change

A missing PAT with an unpublished version is now an ::error:: and a non-zero exit. Both packages are still evaluated before failing, so one missing secret doesn't mask the second package, and the blocked releases go to the job summary with both remedies:

## Release blocked

These versions are not on pub.dev and could not be tagged, because the
`RELEASE_PAT` repo secret is not set:

- `extensions-v0.8.1`
- `extensions_flutter-v0.6.0`

Fix it one of two ways:

1. Add a `RELEASE_PAT` secret (fine-grained PAT, `contents: write` on this
   repo) and re-run this workflow. It is idempotent — versions already on
   pub.dev are skipped.
2. Push the tags by hand, core package first:

    git tag extensions-v0.8.1 && git push origin extensions-v0.8.1
    git tag extensions_flutter-v0.6.0 && git push origin extensions_flutter-v0.6.0

Unchanged: versions already on pub.dev are skipped, an existing tag is left alone, and a configured PAT tags and pushes exactly as before. A pubspec with no version: line stays a warning — that's a malformed file, not a blocked release.

Verification

I extracted the step's script from the YAML and ran it the way CI does (bash -e, same env):

Scenario Result
RELEASE_PAT="", current pubspecs (0.8.1 / 0.6.0, neither on pub.dev) exit 1, both errors emitted, summary lists both tags
RELEASE_PAT="", versions already on pub.dev (0.7.1 / 0.5.2) exit 0, no summary written

Both runs hit the real pub.dev API. YAML parses and the script passes bash -n.

This does not publish anything

This only makes the failure visible. 0.8.1 and 0.6.0 are still unpublished — that needs either the RELEASE_PAT secret added, or the two tags pushed by hand. I could not do it from this session: pushing a tag returns 403 (these credentials can push branches but not tags), and there's no tag-creating API available to me.

Worth considering separately: pub.dev automated publishing can be bound to a GitHub Environment instead of a tag pattern, which would let a workflow_dispatch publish with no tag and no PAT at all. That's a pub.dev Admin-tab change plus a rewrite of publish.yml, so it's out of scope here.

🤖 Generated with Claude Code

https://claude.ai/code/session_01P889JtFvr4ypqnHYQZCPag


Generated by Claude Code

When RELEASE_PAT is unset, the tag step emitted a ::warning:: and exited 0,
so the run went green while no tag was pushed and nothing published. That is
how extensions 0.8.0 sat unpublished from 2026-08-31 until it was superseded
by 0.8.1 without anyone noticing: pub.dev still serves 0.7.1, the repo has no
tags at all, and every "Auto-tag releases" run reports success.

A missing PAT with an unpublished version is now an ::error:: and a non-zero
exit. Both packages are still checked before failing, so one missing secret
doesn't hide the second package, and the blocked releases are written to the
job summary with the two ways to fix it -- add the secret and re-run, or push
the listed tags by hand.

Unchanged: versions already on pub.dev are skipped, an existing tag is left
alone, and a set PAT tags and pushes exactly as before. A pubspec with no
version line stays a warning, since that is a malformed file rather than a
blocked release.

Verified by extracting the step's script and running it as CI does: with
RELEASE_PAT empty against the current pubspecs it exits 1 and lists
extensions-v0.8.1 and extensions_flutter-v0.6.0; against versions already on
pub.dev it exits 0 and writes no summary.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P889JtFvr4ypqnHYQZCPag
@jamiewest
jamiewest merged commit 8f9cce9 into main Sep 21, 2026
3 checks passed
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.

2 participants