Skip to content

fix(github-action): fetch tags in ifReleaseCommit to not re-release already released commit#163

Merged
dangreen merged 1 commit into
mainfrom
fix/if-release-commit-shallow-clone
Jul 6, 2026
Merged

fix(github-action): fetch tags in ifReleaseCommit to not re-release already released commit#163
dangreen merged 1 commit into
mainfrom
fix/if-release-commit-shallow-clone

Conversation

@dangreen

@dangreen dangreen commented Jul 6, 2026

Copy link
Copy Markdown
Member

The problem

Dispatching the release workflow (e.g. a manual release via workflow_dispatch) while the branch HEAD is an already released chore(release): commit misdetects the context as release instead of pull-request.

actions/checkout produces a shallow clone without tags by default, and ifReleaseCommit verifies the release tag only locally (git rev-parse --verify). The tag for the current version is not found in the clone, so the commit is treated as a fresh release commit. The release flow then re-runs for the already published version and fails on publish:

409 Conflict - PUT https://npm.pkg.github.com/... - Cannot publish over existing version

Reproduced in real conditions: https://github.com/TrigenSoftware/dummy/actions/runs/28784646035

The fix

ifReleaseCommit now fetches tags from the remote before checking them (same as the tag and maintenanceBranch steps do). The fetch is skipped when the commit message is not a release commit, and in dryRun mode.

Added unit tests for ifReleaseCommit reproducing the scenario with a real --depth 1 --no-tags clone.

🤖 Generated with Claude Code

@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 28785949201

Coverage decreased (-4.4%) to 59.875%

Details

  • Coverage decreased (-4.4%) from the base build.
  • Patch coverage: 5 of 5 lines across 1 file are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 938
Covered Lines: 622
Line Coverage: 66.31%
Relevant Branches: 505
Covered Branches: 242
Branch Coverage: 47.92%
Branches in Coverage %: Yes
Coverage Strength: 8.97 hits per line

💛 - Coveralls

@dangreen dangreen merged commit 428966e into main Jul 6, 2026
6 checks passed
@dangreen dangreen deleted the fix/if-release-commit-shallow-clone branch July 6, 2026 10:52
@github-actions github-actions Bot mentioned this pull request Jul 6, 2026
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