Skip to content

fix: 重複發行防護在檢查通過時反而讓流程失敗 - #7

Merged
nojackno2-ctrl merged 1 commit into
mainfrom
claude/memory-cpu-optimization-p0z5ve
Aug 4, 2026
Merged

fix: 重複發行防護在檢查通過時反而讓流程失敗#7
nojackno2-ctrl merged 1 commit into
mainfrom
claude/memory-cpu-optimization-p0z5ve

Conversation

@nojackno2-ctrl

Copy link
Copy Markdown
Owner

問題

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

`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
@nojackno2-ctrl
nojackno2-ctrl merged commit 79c71ee into main Aug 4, 2026
2 checks passed
@nojackno2-ctrl
nojackno2-ctrl deleted the claude/memory-cpu-optimization-p0z5ve branch August 4, 2026 23:40
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