fix(ci): stop double npm publish on bot releases (TLOG 409)#187
Merged
Conversation
release-npm.yml runs as github-actions[bot]: it creates the fli-js-v* tag/Release AND publishes by calling publish-npm.yml via workflow_call. But publish-npm.yml also triggers on `release: published`, so the bot-created Release fired a SECOND publish of the identical artifact. Two provenance submissions for the same version collide on the Sigstore transparency log: npm error code TLOG_CREATE_ENTRY_ERROR npm error error creating tlog entry - (409) an equivalent entry already exists Exclude github-actions[bot] from the release-triggered publish so only the workflow_call path (release-npm) publishes. Human-created Releases and explicit environment=npm dispatches still publish. This mirrors the existing guard in publish.yml (PyPI), which excludes bot releases for the same reason.
Contributor
Test Results 4 files 4 suites 1m 23s ⏱️ Results for commit e2dedd3. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Running
release-npmpublished the same version twice, and the second publish failed with:Root cause — a double-publish race.
release-npm.ymlruns asgithub-actions[bot]and does two things that each lead to a publish of the same artifact:publish-npm.ymlviaworkflow_call(the canonical publish path).fli-js-v*tag + GitHub Release — andpublish-npm.ymlalso triggers onrelease: published, so the bot-created Release fired a secondnpm-publish.Two
npm publish --provenanceruns for the identical artifact submit the identical provenance bundle to the Sigstore transparency log; the second collides →409 / TLOG_CREATE_ENTRY_ERROR. (@punitarani/fli@0.0.4ended up not published as a result — the registry write never completed; currentlatestis0.0.3.)The PyPI side already guards against this exact race in
publish.yml(github.actor != 'github-actions[bot]'); the npm side was missing the equivalent guard.Change
.github/workflows/publish-npm.yml— exclude bot-created releases from the release-triggered publish:Behavior after the fix:
release-npm(bot) workflow_call →inputs.environment == 'npm'→ publishes once. ✅fli-js-v*Release (manual fallback) → still publishes. ✅workflow_dispatchenv=npm → still publishes. ✅After merge
0.0.4is burned (its provenance tlog entry already exists, and it's unpublished). Don't try to reuse it. main is already at0.0.4, so the nextrelease-npmrun bumps to0.0.5and will publish exactly once.release-npmwill now work end-to-end.https://claude.ai/code/session_01R2vZihmSWV2wvRawjF4Gjo
Generated by Claude Code
Greptile Summary
This PR adds a
github.actor != 'github-actions[bot]'guard to thenpm-publishjob'sifcondition inpublish-npm.yml, mirroring the identical guard already present on the PyPI side. The fix eliminates a double-publish race whererelease-npm.ymlboth calledpublish-npm.ymldirectly viaworkflow_calland created a GitHub Release that re-triggered the same workflow, causing a Sigstore transparency log collision (TLOG 409).release:-triggered path; theworkflow_callpath (inputs.environment == 'npm') is unaffected and remains the canonical publish route.fli-js-v*releases (manual fallback) continue to work because a human actor passes the new check.fli-js-testsandrelease-buildstill run a second time (they lack the bot-actor guard), wasting a small amount of CI minutes, butnpm-publishis correctly skipped so no functional regression occurs.Confidence Score: 5/5
Safe to merge — single-line condition change with well-understood scope and a direct parallel in the existing PyPI guard.
The change is a targeted, one-clause addition to a GitHub Actions if expression. Both branches of the condition (workflow_call via inputs.environment == 'npm' and human release events) are exercised as before; only the bot-created release path is newly excluded. The logic exactly mirrors the battle-tested PyPI guard already in the repo.
No files require special attention.
Important Files Changed
Sequence Diagram
sequenceDiagram actor Human participant RN as release-npm.yml participant PUB as publish-npm.yml participant GHR as GitHub Release participant NPM as npm registry Human->>RN: "workflow_dispatch (bump=patch)" RN->>RN: bump version, commit, push tag RN->>GHR: "gh release create fli-js-vX.Y.Z (actor=github-actions[bot])" RN->>PUB: "workflow_call (inputs.environment=npm)" Note over GHR,PUB: release:published event fires GHR-->>PUB: "release event (actor=github-actions[bot])" PUB->>PUB: npm-publish if check Note over PUB: workflow_call path: inputs.environment=='npm' → TRUE ✅ PUB->>NPM: npm publish --provenance ✅ PUB->>PUB: npm-publish if check (release event path) Note over PUB: release path: github.actor=='github-actions[bot]' → SKIP ✅ Note over PUB: Before fix: second publish → TLOG 409 error ❌Reviews (1): Last reviewed commit: "fix(ci): stop double npm publish on bot ..." | Re-trigger Greptile