chore(ci): 收斂依賴機器人為單一 Dependabot 並補齊分組與自動合併 - #1023
Conversation
- 刪除 renovate.json:Renovate App 從未安裝,該設定自 2025-12-26 起 8 個月零生效 - dependabot.yml 為 npm 與 github-actions 加 minor/patch grouping,收斂每週 PR 數 - 補 /security-headers entry:該目錄自帶 npm lockfile 不在 pnpm workspace 內 - major 刻意不分組,避免相容性待評估的升級卡住同批安全更新 - 新增 dependabot-automerge workflow:minor/patch 掛 auto-merge、major 標 major-update - 該 workflow 用 pull_request_target 取寫入權限,不 checkout PR 分支也不執行 PR 程式碼 - 合併仍由 branch protection 與 required checks 把關,auto-merge 僅為排隊機制 - 034 文件標註作廢並記錄失效原因,CLAUDE.md 立單一依賴機器人 SSOT 規則 - README workflow 數量三處不一致(9/9/10)一併校正為實際的 13 測試:python yaml 解析兩份設定通過;002 記分守門通過;pre-commit 六步全綠 Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
Dependency ReviewThe following issues were found:
License Issues.github/workflows/dependabot-automerge.yml
OpenSSF Scorecard
Scanned Files
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b7a9ed6314
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| - 自動化規則一律寫進 `.github/dependabot.yml`,**禁止**再引入第二套機器人設定造成重複 PR。 | ||
| - minor/patch 由 `.github/workflows/dependabot-automerge.yml` 掛 GitHub auto-merge;major 只加 `major-update` 標籤,需人工評估相容性。 | ||
| - 該 workflow 以 `pull_request_target` 取得寫入權限,**不得**在其中 checkout PR 分支或執行 PR 內程式碼。 |
There was a problem hiding this comment.
此處建立了「只准 Dependabot、禁止第二套機器人」的新 repo-wide CI 流程規則,但同一提交未更新根 AGENTS.md,使 Agent SOP 與 CLAUDE.md 的 SSOT 立即分歧;請將這套依賴機器人政策與安全限制同步寫入 AGENTS.md。
AGENTS.md reference: AGENTS.md:L122-L122
Useful? React with 👍 / 👎.
| | **樣式** | Tailwind CSS 3.4 | | ||
| | **測試** | Vitest 4.1 + Playwright 1.57 | | ||
| | **套件管理** | pnpm 9.10.0 (Monorepo) | | ||
| | **CI/CD** | GitHub Actions (13 workflows) | |
There was a problem hiding this comment.
此提交完成後,git ls-tree 在 .github/workflows 下只列出 12 個 YAML workflow(已包含新增的 Dependabot workflow),因此這裡以及同次修改的另外兩個「13」都會向使用者與稽核者提供錯誤的 CI 清單數量;請統一更正為 12,或避免硬編碼此統計值。
AGENTS.md reference: AGENTS.md:L163-L163
Useful? React with 👍 / 👎.
問題
盤點 open PR 時發現 6 個 Dependabot PR 長期堆積,其中 #1014、#979 checks 全綠卻掛置數週,#980 與 #995 是同一個
react-router-domv7 升級的重複 PR。追下去發現根因不是 Dependabot 設定太寬,而是自動化責任被交給了一個從未生效的機器人。根因:
renovate.json是死設定gh pr list --author app/renovate --state allrenovate.json建立時間docs/dev/034)Renovate App 從未安裝,這份含
automerge: true的設定 8 個月完全沒有生效。更糟的是
.github/dependabot.yml依照同一份文件被刻意降規格:於是唯一實際在跑的機器人失去 grouping 與自動合併能力 —— 034 文件當初想解決的「PR 堆積」問題原樣復發。
修改
1. 刪除
renovate.json,確立單一依賴機器人 SSOT。2.
.github/dependabot.ymlminor/patchgrouping → 每週 PR 數從 ~6 收斂到 1–2vite-react-ssg耦合),混進群組會讓同批安全更新一起被卡住/security-headersentry:該目錄自帶 npm +package-lock.json、不在 pnpm workspace 內,先前只能被動等漏洞警報冒 PR(chore(deps): bump sharp from 0.34.5 to 0.35.2 in /security-headers in the npm_and_yarn group across 1 directory #979 即為此類)@types/nodemajor ignore3. 新增
.github/workflows/dependabot-automerge.ymlminor/patch→gh pr merge --auto --squashmajor→ 只加major-update標籤(gh label create --force確保冪等,不依賴 repo 端手動前置設定)update-type取群組內最高 semver,major 混入時整包落到人工審查,不會被誤自動合併安全性
Dependabot 觸發的
pull_request事件其GITHUB_TOKEN為唯讀,故必須用pull_request_target取得寫入權限。本 workflow 刻意不 checkout PR 分支、不執行 PR 內任何程式碼,僅呼叫 GitHub API,避免pull_request_target的權限提升風險。合併仍由 branch protection 與 required checks 把關 —— auto-merge 只是排隊機制,checks 未過不會合併,不存在繞過審查控制的路徑。
4. 文件同步
docs/dev/034標註 ⛔ 作廢並記錄失效原因(保留歷史,不刪除)CLAUDE.md新增「依賴機器人 SSOT」段落,禁止再引入第二套機器人設定DEPENDENCY_UPGRADE_PLAN.md移除已不適用的 Renovate 選項README.mdworkflow 數量三處不一致(9 / 9 / 10)一併校正為實際的 13驗證
尚未處理
pnpm.overridesvite-react-ssg相容性,本 PR 的 major 政策正是為此保留人工關卡🤖 Generated with Claude Code