Skip to content

fix(release): check the release tag before creating a draft - #204

Merged
jmeridth merged 1 commit into
mainfrom
fix/release-draft-check-tag-before-draft
Oct 1, 2026
Merged

jmeridth merged 1 commit into
mainfrom
fix/release-draft-check-tag-before-draft

Conversation

@jmeridth

@jmeridth jmeridth commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator

Fixes #202

Pull Request

Proposed Changes

The tag check now runs before release-drafter writes anything, so a run that fails on an existing tag no longer leaves an orphan draft.

  • New "Resolve release tag" step runs the same pinned release-drafter action with dry-run: true to get tag_name.
  • "Check release tag" reads that output and runs before "Draft release".
  • "Draft release" is unchanged and moves after the check. Later steps and job outputs still read steps.release-drafter.outputs.*.

The change is in release-draft.yaml, which every variant calls, and in the consolidated release.yaml, which had the same ordering.

Proof it works

  • release-drafter v7.7.0 (34d8067) sets tag_name in dry-run mode. upsertRelease returns undefined when dryRun is set. setActionOutput then falls back to the payload tag (set-action-output.ts lines 26 and 39). The bundled dist/actions/drafter/run.js has the same logic.
  • Local runs: shellcheck scripts/*.sh, bats scripts/tests/ (31 ok), the inline-copy drift check from test-scripts.yaml, actionlint, and pre-commit run --all-files all pass.

Risk

Low. The change reorders steps in one job, and the new step is read-only. Each release run makes one extra set of read API calls.

AI role

Claude Opus 5.5 wrote the change. A human reviews it.

Review focus

  • Both release-drafter steps take identical inputs, so the dry-run tag matches the tag the real draft uses.

Readiness Checklist

Author/Contributor

  • If documentation is needed for this change, has that been included in this pull request

## What/Why

The "Check release tag" step ran after release-drafter had already
created the draft. When the tag existed at another commit, the job
failed but left an orphan draft behind.

A new "Resolve release tag" step now runs the same pinned
release-drafter action with dry-run: true. The tag check reads that
step's tag_name and runs before the real "Draft release" step. The
draft step itself is unchanged, so later steps and job outputs still
read steps.release-drafter.outputs.*. Applied to release-draft.yaml
(used by every variant) and to the consolidated release.yaml.

Fixes #202

## Proof it works

release-drafter v7.7.0 (34d8067) sets tag_name in dry-run mode.
upsertRelease returns undefined when dryRun is set, and
setActionOutput falls back to the payload tag
(src/actions/drafter/config/set-action-output.ts lines 26 and 39).
shellcheck, bats (31 ok), the inline-copy drift check, actionlint, and
pre-commit all pass locally.

## Risk

Low. Step order changes in one job, and the extra step is read-only.
Each release run makes one more set of read API calls.

## AI role

Claude Opus 5.5 wrote the change. A human reviews it.

## Review focus

- Both release-drafter steps take identical inputs, so the dry-run tag
  matches the tag the real draft uses.

Signed-off-by: jmeridth <jmeridth@gmail.com>
@jmeridth jmeridth self-assigned this Oct 1, 2026
@jmeridth jmeridth changed the title fix(release-draft): check the release tag before creating a draft fix(release): check the release tag before creating a draft Oct 1, 2026
@github-actions
github-actions Bot marked this pull request as ready for review October 1, 2026 15:04
@github-actions
github-actions Bot requested a review from zkoppert as a code owner October 1, 2026 15:04
@jmeridth
jmeridth merged commit 038160c into main Oct 1, 2026
12 of 16 checks passed
@jmeridth
jmeridth deleted the fix/release-draft-check-tag-before-draft branch October 1, 2026 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

release-draft: tag check runs after the draft is created, leaving an orphan draft when the tag exists

2 participants