fix: 重複發行防護在檢查通過時反而讓流程失敗 - #7
Merged
Merged
Conversation
`gh release view` exits 1 when the release does not exist — which is the case the guard is written to allow — and the runner ends every pwsh step with `exit $LASTEXITCODE`. So the step inherited that 1 and failed the release run at precisely the moment the check had succeeded. It printed "v1.1.3 is free" and then failed, which is as clear a statement of the bug as any. The check itself was right and the ordering saved the run: nothing was built, no tag was created and nothing was published. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KqeMPekXsH3e1tSgJkWYyz
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.
問題
v1.1.3 的第一次發行執行在「Verify the release does not already exist」這一步失敗(run 30865437528),但日誌其實印出了
v1.1.3 is free— 判斷邏輯是對的,throw沒有觸發。原因是
gh release view在 release 不存在時回傳 exit code 1,而那正是這道防護要放行的情況;GitHub Actions 又會在每個 pwsh 步驟結尾自動附加exit $LASTEXITCODE。於是步驟繼承了那個 1,在檢查成功的當下把整個發行流程判定為失敗。修正
明確重設離開碼,並加上註解說明為什麼需要它。同時把
gh release view改為--json tagName並導向Out-Null,避免在日誌裡印出整段 release 內容。影響範圍
沒有任何東西被發布。因為這道檢查排在建置之前,建置、artifact 上傳與發行步驟全部標記為 skipped,tag 也沒有建立(手動觸發模式下 tag 是在發行那一步才建立的)。狀態是乾淨的,修好後直接重跑同一個版號即可。
🤖 Generated with Claude Code
https://claude.ai/code/session_01KqeMPekXsH3e1tSgJkWYyz
Generated by Claude Code