Skip to content

[chore] 自動化週發布:weekly-release-pr workflow - #366

Merged
Erick52106 merged 7 commits into
developfrom
chore/weekly-release-pr
Apr 26, 2026
Merged

[chore] 自動化週發布:weekly-release-pr workflow#366
Erick52106 merged 7 commits into
developfrom
chore/weekly-release-pr

Conversation

@Erick52106

@Erick52106 Erick52106 commented Apr 26, 2026

Copy link
Copy Markdown
Collaborator

背景

develop → main 的 release PR 需要人工手動開,容易忘記或延誤。
專案主力開發時間為平日晚上與週末,在週六早上自動開好 release PR,
讓開發者可以在週末有充裕時間 review 並 merge。

變更

  • 新增 .github/workflows/weekly-release-pr.yml
  • cron 觸發:0 2 * * 6(週六 10:00 UTC+8)
  • 支援 workflow_dispatch 手動觸發
  • develop commits ahead == 0 → skip
  • 已有 open release PR → skip
  • PR 標題格式:[release] develop → main (YYYY-MM-DD)

完成條件

  • workflow_dispatch 手動觸發正確開出 release PR
  • develop == main 時正確 skip
  • 已有 open release PR 時正確 skip

本 PR 明確不做

  • 不實現自動 merge release PR(需 PAT + 額外權限)
  • 不修改現有 CI 或其他 workflow
  • 不處理 GITHUB_TOKEN 不觸發 CI 的問題(separate major issue,需 Fix 3)

closes #365

🤖 Generated with Claude Code

Summary by CodeRabbit

发布说明

  • 新功能

    • 新增定时/手动自动化流程:比较 develop 与 main 的提交差异,若有差异则自动创建并命名发布拉取请求,并触发后续 CI。
  • 改进

    • 增强依赖关系检查脚本的容错性,允许缺少“Depends on” 行时继续执行,减少错误中断。

refs #365

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Apr 26, 2026

Copy link
Copy Markdown
Contributor

PR Scope Police

  • PASS: scope checks passed.

Snapshot

  • Mode: standard PR
  • Docs/template/metadata only: no
  • Changed files: 2
  • Diff lines (+/-): 99
  • Product surfaces: none
  • Dependency blocked: no
  • Auto-close triggered: no
  • Auto-close label: scope-violation
  • Dependency block label: blocked-by-dependency
  • Bypass label: scope-exception

@github-actions github-actions Bot added the needs-codex-review New commits pushed after CHANGES_REQUESTED — pending Codex review label Apr 26, 2026
@Erick52106 Erick52106 changed the title chore: weekly release PR workflow(週六 10:00 UTC+8) [chore] 自動化週發布:weekly-release-pr workflow Apr 26, 2026
@coderabbitai

coderabbitai Bot commented Apr 26, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@Erick52106 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 48 minutes and 55 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 48 minutes and 55 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: bc7ce79e-a497-4077-9d58-100925988d3d

📥 Commits

Reviewing files that changed from the base of the PR and between 63ea5fc and 1204b40.

📒 Files selected for processing (1)
  • .github/workflows/weekly-release-pr.yml
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 標題明確說明新增 weekly-release-pr workflow,與主要變更內容相符。
Linked Issues check ✅ Passed PR 完整實現 issue #365 的所有編碼要求:新增 workflow 檔案、cron 排程、workflow_dispatch 支援、develop 領先偵測、重複 PR 迴避、PR 標題規格,以及正確權限設定。
Out of Scope Changes check ✅ Passed 所有變更均與 issue #365 的目標範圍相關:workflow 檔案新增與 pr-metadata-check.sh 增強,以支援 workflow 的正常運作,無超出範圍的改動。

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/weekly-release-pr

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/weekly-release-pr.yml (1)

49-66: ⚠️ Potential issue | 🔴 Critical

Critical:YAML 區塊純量縮排錯誤,workflow 無法被解析

run: | 是 YAML literal block scalar,所有屬於該腳本的行(包含空行內含內容的後續行)必須維持與第一行相同或更深的縮排。目前 line 56 --body "## Weekly Release — $DATE 之後的 line 58、60、62-65 全部從第 0 欄開始,YAML parser 會在 line 58 結束 block scalar 並把 Auto-generated by weekly-release-pr workflow. 當成新的 key 來解析,因此 actionlint / yamllint 都報 could not find expected ':'。這代表這個 workflow 檔案根本無法載入,cron 也不會觸發。

需要修正才能 merge。建議改用 heredoc 或先把 body 寫到檔案再帶入 --body-file,例如:

♻️ 建議修法(heredoc + --body-file)
       - name: Create release PR
         if: steps.check.outputs.commits_ahead != '0' && steps.existing.outputs.existing_pr == ''
         env:
           GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
         run: |
           DATE=$(TZ=Asia/Taipei date +%Y-%m-%d)
           COMMITS_AHEAD=${{ steps.check.outputs.commits_ahead }}
-          gh pr create \
-            --base main \
-            --head develop \
-            --title "[release] develop → main ($DATE)" \
-            --body "## Weekly Release — $DATE
-
-          Auto-generated by weekly-release-pr workflow.
-
-          **Commits ahead:** $COMMITS_AHEAD
-
-          ### Checklist
-          - [ ] CI 通過
-          - [ ] 確認無 half-finished feature
-          - [ ] Merge"
+          cat > /tmp/release-pr-body.md <<EOF
+          ## Weekly Release — $DATE
+
+          Auto-generated by weekly-release-pr workflow.
+
+          **Commits ahead:** $COMMITS_AHEAD
+
+          ### Checklist
+          - [ ] CI 通過
+          - [ ] 確認無 half-finished feature
+          - [ ] Merge
+          EOF
+          gh pr create \
+            --base main \
+            --head develop \
+            --title "[release] develop → main ($DATE)" \
+            --body-file /tmp/release-pr-body.md
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/weekly-release-pr.yml around lines 49 - 66, The YAML
script block under run: | is incorrectly dedented causing the literal block
scalar to end early; fix by either indenting every line of the shell script
(including the multi-line PR body) to match the run: | block or replace the
inline multi-line --body with a heredoc/temporary file approach: build the BODY
using DATE and COMMITS_AHEAD, write it to a temp file (e.g., /tmp/pr_body.txt)
and pass it to gh pr create with --body-file, ensuring the gh pr create
invocation (and variables DATE and COMMITS_AHEAD) remain inside the properly
indented run block.
🧹 Nitpick comments (2)
.github/workflows/weekly-release-pr.yml (2)

39-43: Minor:gh pr list --jq '.[0].number' 在無結果時為空字串,行為正確但建議補註

當沒有現有 open release PR 時,.[0].number 會輸出空字串,使 existing_pr='' 並讓後續 Create release PRsteps.existing.outputs.existing_pr == '' 判斷成立,邏輯沒問題。只是未來若有人改 --jq 表達式(例如改成 .[0]length)可能會默默壞掉,建議在這個 step 加一行註解說明「空字串 = 無現有 PR」。僅供參考。

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/weekly-release-pr.yml around lines 39 - 43, Add a short
inline comment in the workflow step around the EXISTING assignment (the gh pr
list --jq '.[0].number' call and the existing_pr output) clarifying that an
empty string indicates "no existing open release PR" so future changes to the
--jq expression won't silently change behavior; reference the EXISTING variable,
the gh pr list command, and steps.existing.outputs.existing_pr in the comment.

29-31: Minor:此 step 只是印 log,並沒有真的「skip」後續步驟

Skip if nothing to release 只在 commits_ahead == '0' 時印訊息,後面 Check for existing open release PRCreate release PR 各自再用 if: 控制是否執行,行為上是正確的,只是 step 名稱容易讓人誤以為它會中止後續流程。可以考慮把名字改成 Log: develop is up to date 或乾脆把它合併進 check step 的 echo,讓閱讀 workflow 的人不會誤判控制流。僅供參考,非阻擋項。

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/weekly-release-pr.yml around lines 29 - 31, The step named
"Skip if nothing to release" is only printing a message and does not actually
halt the workflow; rename the step to a clearer label like "Log: develop is up
to date" or merge its echo into the prior check step to avoid misleading
readers; update the step name referenced as "Skip if nothing to release" (and
adjust any documentation) and ensure "Check for existing open release PR" and
"Create release PR" remain controlled by their own if: conditions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/weekly-release-pr.yml:
- Around line 56-65: Update the multiline --body string used to create the PR
(the --body "## Weekly Release — $DATE ... $COMMITS_AHEAD" template) to include
the required scope/CI fields: add "Source of truth:`...`" (or "Source of
truth:"), "Depends on PR:none" (or a PR number), a "本 PR 明確不做" section, and a
"Backend contract already in develop" checklist with the "yes" box pre-checked;
keep the existing DATE and COMMITS_AHEAD variables and checklist items but
expand the body to match the suggested template so the [release] PR passes the
validations enforced by the CI and pr-scope-police workflows.
- Around line 45-52: The workflow currently injects the default GitHub Actions
token via GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}, which prevents other workflows
(CI/scope-police) from being triggered by the PR created with gh pr create;
replace the token injection with a project Personal Access Token or GitHub App
token stored in a secret (e.g., GH_PAT or GH_APP_TOKEN) and use that secret as
GH_TOKEN for the gh pr create step, or add an authentication step to mint a
GitHub App token (e.g., actions/create-github-app-token) and export it to
GH_TOKEN before running gh pr create; if you intend to keep using the default
behavior, explicitly document in the PR description/README that automated
release PRs will not trigger downstream workflows.

---

Outside diff comments:
In @.github/workflows/weekly-release-pr.yml:
- Around line 49-66: The YAML script block under run: | is incorrectly dedented
causing the literal block scalar to end early; fix by either indenting every
line of the shell script (including the multi-line PR body) to match the run: |
block or replace the inline multi-line --body with a heredoc/temporary file
approach: build the BODY using DATE and COMMITS_AHEAD, write it to a temp file
(e.g., /tmp/pr_body.txt) and pass it to gh pr create with --body-file, ensuring
the gh pr create invocation (and variables DATE and COMMITS_AHEAD) remain inside
the properly indented run block.

---

Nitpick comments:
In @.github/workflows/weekly-release-pr.yml:
- Around line 39-43: Add a short inline comment in the workflow step around the
EXISTING assignment (the gh pr list --jq '.[0].number' call and the existing_pr
output) clarifying that an empty string indicates "no existing open release PR"
so future changes to the --jq expression won't silently change behavior;
reference the EXISTING variable, the gh pr list command, and
steps.existing.outputs.existing_pr in the comment.
- Around line 29-31: The step named "Skip if nothing to release" is only
printing a message and does not actually halt the workflow; rename the step to a
clearer label like "Log: develop is up to date" or merge its echo into the prior
check step to avoid misleading readers; update the step name referenced as "Skip
if nothing to release" (and adjust any documentation) and ensure "Check for
existing open release PR" and "Create release PR" remain controlled by their own
if: conditions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: de2e9ffe-93c7-46e3-a2b3-bee427a4b7b3

📥 Commits

Reviewing files that changed from the base of the PR and between 9b198c2 and 842ab9f.

📒 Files selected for processing (1)
  • .github/workflows/weekly-release-pr.yml

Comment thread .github/workflows/weekly-release-pr.yml
Comment thread .github/workflows/weekly-release-pr.yml Outdated
Erick52106 and others added 3 commits April 26, 2026 21:18
…-pr workflow

- Fix 1: Replace multiline --body with heredoc to resolve YAML indentation error
- Fix 2: Add clarifying comment for skip logic guard conditions

refs #366

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
refs #366

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
refs #366

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (2)
.github/workflows/weekly-release-pr.yml (2)

53-64: ⚠️ Potential issue | 🔴 Critical

Critical:PR body 仍缺少 scope-gate 必要欄位,自動建立的 release PR 會被 CI 直接擋下(需要修正才能 merge)

.github/workflows/ci.yml scope-gate 的 releaseBodyValid 判斷(見 relevant snippet L112-129),release PR body 必須同時包含:

  • Source of truth:Source of truth:
  • Depends on PR: 後接 none#<num>
  • 字串 本 PR 明確不做
  • Backend contract already in develop: 區塊內勾選 - [x] yes(且不能同時勾選 no)

目前 L53-64 的 body 模板只有「Auto-generated / Commits ahead / 3 項 checklist」,上述 4 個必要欄位全部缺失,因此 releaseBodyValid=falserun_ci=false,每一個自動週發布 PR 都會卡在 scope-gate 無法 merge,違反本 PR「自動週發布」目標。另外 scripts/pr-metadata-check.sh(L206-221)雖只驗證 title prefix 對 release promotion 的對應關係,這部份目前是符合的,但 body 的 scope-gate 驗證還是會擋。

♻️ 建議補齊 body 模板
           cat > /tmp/release-pr-body.md <<EOF
 ## Weekly Release — $DATE

 Auto-generated by weekly-release-pr workflow.

 **Commits ahead:** $COMMITS_AHEAD

+## Scope 對齊
+- Source of truth:#365
+- Depends on PR:none
+- Backend contract already in develop:
+  - [x] yes
+  - [ ] no
+
+## 本 PR 明確不做
+- 不做 hotfix
+- 不調整 CI / workflow
+- 不引入新的對外通知
+
 ### Checklist
 - [ ] CI 通過
 - [ ] 確認無 half-finished feature
 - [ ] Merge
 EOF
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/weekly-release-pr.yml around lines 53 - 64, The generated
release PR body is missing the scope-gate required fields checked by
releaseBodyValid in ci.yml, so update the /tmp/release-pr-body.md template
generation (the here-doc block using $DATE and $COMMITS_AHEAD) to include: a
"Source of truth:" (accept both full-width and ASCII colon), a "Depends on PR:"
line followed by "none" or "#<num>", the literal phrase "本 PR 明確不做", and a
"Backend contract already in develop:" checklist with "- [x] yes" (and ensure "-
[ ] no" is not checked); keep existing checklist items and title/commit info
intact and validate against scripts/pr-metadata-check.sh expectations.

71-75: ⚠️ Potential issue | 🟠 Major

Major:gh workflow run ci.yml --ref develop 不會把 check 掛到自動建立的 release PR 上

這個 step 看起來是想補償「GITHUB_TOKEN 建立的 PR 不會觸發 workflow」的限制,但實際上 --ref develop 會以 workflow_dispatch 在 develop branch 上跑一個獨立的 run,這個 run 不會出現在 release PR 的 checks 區,也不會被 branch protection(要求 CI 在 PR 上 pass 才能 merge 進 main)認可。結果:

  • develop 那邊多跑一次(其實平常 push 已經會跑),對 release PR 本身沒幫助。
  • release PR 仍維持 0 個 check,需要人類手動 close/reopen 或 push 一個 commit 觸發。

若要根治,建議改用 GitHub App token(例如 actions/create-github-app-token)或 PAT 注入 GH_TOKEN 後再 gh pr create,這樣建立 PR 時就會正常觸發 pull_request event 的 CI。或者在 PR description / README 明示「自動 release PR 需要手動 close/reopen 一次以觸發 CI」當作已知 workaround,並把這個 Dispatch CI against develop step 移除(避免誤導維運者以為 CI 已經跑在 PR 上)。

另:此 step 依賴 ci.yml 已宣告 workflow_dispatch: trigger,請確認。

#!/bin/bash
# 確認 ci.yml 是否支援 workflow_dispatch trigger
fd -t f 'ci.yml' .github/workflows | xargs -I{} sh -c 'echo "=== {} ==="; sed -n "1,30p" {}"'
rg -n -C2 'workflow_dispatch' .github/workflows/ci.yml
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/weekly-release-pr.yml around lines 71 - 75, The "Dispatch
CI against develop" step uses gh workflow run ci.yml --ref develop which does
not attach checks to the auto-created release PR; remove this step and instead
obtain a GitHub App token or PAT (e.g., use actions/create-github-app-token or
inject a PAT into GH_TOKEN) and call gh pr create (or recreate the PR with that
token) so the workflow triggers via the pull_request event and appears on the PR
checks; also verify ci.yml declares workflow_dispatch if you still intend to use
workflow dispatch in any workflow.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In @.github/workflows/weekly-release-pr.yml:
- Around line 53-64: The generated release PR body is missing the scope-gate
required fields checked by releaseBodyValid in ci.yml, so update the
/tmp/release-pr-body.md template generation (the here-doc block using $DATE and
$COMMITS_AHEAD) to include: a "Source of truth:" (accept both full-width and
ASCII colon), a "Depends on PR:" line followed by "none" or "#<num>", the
literal phrase "本 PR 明確不做", and a "Backend contract already in develop:"
checklist with "- [x] yes" (and ensure "- [ ] no" is not checked); keep existing
checklist items and title/commit info intact and validate against
scripts/pr-metadata-check.sh expectations.
- Around line 71-75: The "Dispatch CI against develop" step uses gh workflow run
ci.yml --ref develop which does not attach checks to the auto-created release
PR; remove this step and instead obtain a GitHub App token or PAT (e.g., use
actions/create-github-app-token or inject a PAT into GH_TOKEN) and call gh pr
create (or recreate the PR with that token) so the workflow triggers via the
pull_request event and appears on the PR checks; also verify ci.yml declares
workflow_dispatch if you still intend to use workflow dispatch in any workflow.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 921d6243-bbd0-4b44-a404-25e4689f7201

📥 Commits

Reviewing files that changed from the base of the PR and between 842ab9f and 3acd202.

📒 Files selected for processing (2)
  • .github/workflows/weekly-release-pr.yml
  • scripts/pr-metadata-check.sh

…mplate

refs #366

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Erick52106

Copy link
Copy Markdown
Collaborator Author

本次 push 修正摘要

Fix 1:Release PR body 補齊 scope police 必要欄位(Critical)

自動產生的 body 新增:

  • Source of truth: develop release promotion on $DATE
  • Depends on PR: none
  • Backend contract already in develop: [x] yes
  • 本 PR 明確不做

另將 section header 從 ## Backend contract... 改為無 ## 前綴,原因:pr-metadata-check.shchecked_item awk function 使用 [-]* 匹配 section header 前綴,# 不在匹配範圍,導致 pre-push hook 靜默失敗。

Fix 2:pr-metadata-check.sh 的 depends_on_raw grep 加 || true(Bug fix)

set -euo pipefail + 沒有 || true 保護的 grep subshell:當 [chore] PR body 不含 Depends on PR: 行時,grep exit 1 導致整個 check 腳本靜默終止(exit 1 但無任何輸出)。

Fix 3:新增 "Dispatch CI against develop" step(Major 的 CI 部分)

Release PR 建立後,透過 gh workflow run ci.yml --ref develop 主動 dispatch CI,無需 PAT。CI 結果在 Actions tab 查看。

Scope police 的部分:因 GITHUB_TOKEN 建立的 PR 不觸發 pull_request event,scope police 不會自動跑。但 body 已包含所有必要欄位,手動 re-open 或 push commit 後會正常通過。

@YUAN-117

Copy link
Copy Markdown
Collaborator

Claude Code 審查結論:✅ 可 merge,無 blocker

Blockers

無。

Majors(不擋 merge,建議開 follow-up issue)

  • Dispatch CI against develop step 語意有歧義weekly-release-pr.yml:90-94):gh workflow run 是非同步觸發,dispatch 出去的 CI run 不會顯示在 release PR 的 Checks tab,人工 reviewer 可能誤以為 PR checks 已通過。建議在 PR body 補充說明「此 CI run 與 PR checks 分離,需到 Actions tab 查看」,或後續 follow-up PR 修正。

Minors

  • weekly-release-pr.yml:52COMMITS_AHEAD=${{ steps.check.outputs.commits_ahead }} 建議加引號 → COMMITS_AHEAD="${{ steps.check.outputs.commits_ahead }}"(值為純數字風險低,但應養成習慣防 word splitting)
  • PR body 模板的 [ ] noIf no, this PR is 區塊對 release PR 無意義,建議後續清理,只保留 [x] yes

Nits

  • Cron 0 2 * * 6 = UTC+8 10:00 ✅
  • fetch-depth: 0 使用正確 ✅
  • pr-metadata-check.sh|| true guard 安全、範圍正確 ✅

確認項目

  • GITHUB_TOKEN 權限(contents: read + pull-requests: write)足夠執行 gh pr create
  • Skip conditions(commits ahead == 0、已有 open release PR)邏輯正確 ✅
  • Scope Police 相容性:自動生成的 PR body 格式通過分析 ✅
  • CI 全綠 ✅

refs #366

Co-Authored-By: Codex <codex[bot]@openai.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/weekly-release-pr.yml:
- Around line 41-48: The existing gh/jq pipeline sets EXISTING to the literal
"null" when no PR exists (because jq '.[0].number' yields null -> "null"),
causing steps.existing.outputs.existing_pr to be non-empty and skipping PR
creation; fix by changing the jq expression used in the gh pr list assignment to
coalesce null to an empty string (use jq's alternative/operator to return empty
when .[0].number is null) so that EXISTING is truly empty when no PR exists and
the conditional (steps.existing.outputs.existing_pr == '') behaves correctly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 43a985c4-512d-46ad-86f9-f84393192da2

📥 Commits

Reviewing files that changed from the base of the PR and between 3acd202 and 63ea5fc.

📒 Files selected for processing (1)
  • .github/workflows/weekly-release-pr.yml

Comment thread .github/workflows/weekly-release-pr.yml Outdated
refs #366

Co-Authored-By: Codex <codex[bot]@openai.com>
@Erick52106

Copy link
Copy Markdown
Collaborator Author

已處理這個 conversation:

  • 將 existing release PR lookup 改為 explicit fallback:--jq '.[0].number // '
  • 這樣無既有 PR 時會明確輸出空字串,避免依賴 gh --jq 對 null 的隱含處理
  • 已另外用 gh pr list 實測無結果情境:missing=<> len=0

本機驗證:

  • ruby YAML.load_file('.github/workflows/weekly-release-pr.yml') pass
  • node --test .github/workflows/ci.test.mjs 6/6 pass
  • bash scripts/pr-metadata-check.test.sh pass
  • 抽出 Create release PR run block 後 bash -n pass
  • git diff --check pass

@coderabbitai resolve conversation

@coderabbitai

coderabbitai Bot commented Apr 26, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

@Erick52106 確認收到。.[0].number // '' 的 explicit fallback 讓空結果行為有明確保證,比依賴 gh --jq 對 null 的隱含處理更穩健,修正方向正確。本機驗證項目齊全,感謝確認!

[resolve]


🧠 Learnings used
Learnt from: CR
Repo: nurockplayer/tachigo PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-21T16:18:31.398Z
Learning: PR review 預設採用 metadata-first + reduced review bundle + Gemini CLI first pass + Codex validation 的省 token 路線;優先用 `gh pr view` / GitHub PR files API 獲取 metadata;大型 PR 應一次性提交完整 prompt 而不是並發 Gemini 任務;遇到 429 quota error 立即停止 Gemini 路徑,改由 Codex 以最小必要上下文完成審查

Learnt from: CR
Repo: nurockplayer/tachigo PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-21T16:18:31.398Z
Learning: PR review 時優先檢查高風險區域(auth / payment / permission / migration / breaking change)、scope pollution、inappropriate committed binary assets(font files / images / generated bundles)、CI failures;若發現高嚴重性 blocker,先停止深度審查並報告該 blocker

Learnt from: CR
Repo: nurockplayer/tachigo PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-21T16:18:31.398Z
Learning: 一個 PR = 一個可獨立理解、可獨立驗證的行為變更;PR 應該只完成一個可獨立 review、可獨立測試的任務;預估 diff 超過 400 行、同時修改 backend 與 frontend、或包含非必要 refactor 時,必須先建議拆分而不是直接實作成單一 PR

Learnt from: CR
Repo: nurockplayer/tachigo PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-21T16:18:31.398Z
Learning: 尋找 commit / PR 對應 issue 時使用省 token 路線:先用 `gh issue list` / `gh search issues` 取得 issue metadata;若候選很少(約 0-5 個)由 Codex / Claude 直接判斷;若候選很多或搜尋詞不明確,交給 Gemini CLI 排序候選 issue(最多 3 個);最終必須用 `gh issue view` 驗證選擇;若沒有合適 issue,開新 issue 而不是硬套不相關 issue

Learnt from: CR
Repo: nurockplayer/tachigo PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-21T16:18:31.398Z
Learning: 不要直接推 `main`;日常 feature PR 目標分支是 `develop`;正式 release 依 Git Flow 由 `develop` 開 PR 到 `main`

Learnt from: CR
Repo: nurockplayer/tachigo PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-21T16:17:59.965Z
Learning: PR review output should follow structured format: Summary, Blockers (with file:line), Majors, Minors, Nits, Questions, Recommended Action—to minimize verbose narrative

Learnt from: CR
Repo: nurockplayer/tachigo PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-21T16:18:31.398Z
Learning: 禁止 scope pollution:不要把 issue 沒有明確要求的內容混進同一個 PR,包括額外功能、重構、future work、design exploration

Learnt from: CR
Repo: nurockplayer/tachigo PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-21T16:17:59.965Z
Learning: Before implementing, Claude Code should evaluate if the task will produce > 400 lines of changes; if so, immediately suggest breaking it into smaller PRs and request explicit approval before starting implementation

Learnt from: CR
Repo: nurockplayer/tachigo PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-21T16:17:59.965Z
Learning: PR review should prioritize Gemini for low-cost initial screening (scanning binary files, schema changes, scope pollution), then Claude for verification and decision-making, then Codex for detailed diff review based on risk

Learnt from: nurockplayer
Repo: nurockplayer/tachigo PR: 324
File: scripts/pr-metadata-check.sh:55-75
Timestamp: 2026-04-23T18:06:21.883Z
Learning: In nurockplayer/tachigo, the `checked_item()` function in `scripts/pr-metadata-check.sh` (around line 55-75) has a known parser robustness gap: it exits the awk `in_section` scan on a single blank line, which can cause false negatives if the PR template is adjusted to include blank lines within a section. This is tracked as a follow-up in issue `#332` (relaxing section scan termination condition + adding fixture tests for blank lines, similar section names, conflicting yes/no). No fix is expected in PR `#324`.

Learnt from: CR
Repo: nurockplayer/tachigo PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-21T16:18:31.398Z
Learning: Read-only 操作(讀檔、搜尋、查看 PR / issue metadata、檢查 diff、查看 CI 狀態、列檔案、掃描程式碼)可直接執行;會造成狀態變更的操作(寫檔、commit、push、branch switch、GitHub comment / review / Approve / Merge、issue / PR 建立或編輯)必須先詢問使用者並取得明確同意

@Erick52106
Erick52106 merged commit b54e43b into develop Apr 26, 2026
15 checks passed
@Erick52106
Erick52106 deleted the chore/weekly-release-pr branch April 26, 2026 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-codex-review New commits pushed after CHANGES_REQUESTED — pending Codex review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants