ci: 釘住 action 的 commit SHA,並讓 dependabot 分組、不提 major - #5
Merged
Conversation
兩件事一起修,因為它們造成的是同一個症狀:**掃描上線後各倉庫湧出大量
更新 PR,其中一部分永遠不會變綠**。
## 釘錯了對象:tag 物件 vs. commit
`github/codeql-action` 與 `aquasecurity/trivy-action` 用的是 **annotated tag**。
`git ls-remote --tags --refs` 拿到的是**標籤物件**的 SHA,不是它指向的 commit
——`--refs` 正好把 `^{}` 那幾行濾掉了。Actions 執行時兩者都解得開(所以
workflow 一直是綠的),但 Dependabot 比對的是 commit,於是每個倉庫的每一顆
這種 pin 都被判定成「落後」,每週各開一個 PR。
`actions/*` 用的是 lightweight tag,標籤與 commit 同一顆,所以那五處本來就
是對的——也就是說這個錯**只出現在一部分 pin 上**,看起來更像上游真的有新版,
而不是我們釘錯了東西。
改成 `refs/tags/<ver>^{}` 解出來的 commit,十處 pin 全部對著遠端逐一核對過。
## 沒有分組:一個相依一個 PR
`github/codeql-action` 的四個子 action(init/autobuild/analyze/upload-sarif)
各算一個相依,加上 trivy 是五個,乘以十二個倉庫。補上 `groups` 之後,
每個生態系每週最多一個 PR。
## major 不自動開
實測 dependabot 替四個倉庫提了 `typescript` 5.9 → 7.0,而 `@astrojs/check`
的 peer 範圍是 `^5 || ^6`——`npm ci` 直接 ERESOLVE,那些 PR 沒有任何一顆
有機會變綠。一個沒有人處理得了的紅燈,最後會連同它旁邊真的紅燈一起被忽略。
major 改由人讀 changelog、一次做完;有漏洞的相依走 Dependabot security
updates,是另一條路,不受這個 ignore 影響。
理由與判準見 workspace `decisions/process/掃描的紅燈要有人處理得了.md`。
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.
掃描上線後各倉庫湧出大量 Dependabot PR。這顆修的是成因,不是症狀。
1. 釘錯了對象:tag 物件 vs. commit
github/codeql-action與aquasecurity/trivy-action用的是 annotated tag,而
git ls-remote --tags --refs拿到的是標籤物件的 SHA——--refs正好把^{}那幾行濾掉了。Actions 執行時兩者都解得開(所以 workflow 一直是綠的),但 Dependabot 比對的是
commit,於是每顆這種 pin 都被判定成「落後」,每週各開一個 PR。
actions/*用 lightweight tag,標籤與 commit 同一顆,所以那幾處本來就是對的——這個錯只出現在一部分 pin 上,看起來更像上游真的有新版,而不是我們釘錯。
改成
refs/tags/<ver>^{}解出來的 commit,十處 pin 全部對著遠端逐一核對過。2. dependabot 分組、不自動提 major
補上
groups之後每個生態系每週最多一個 PR,而不是一個相依一個。major 改由人讀 changelog、一次做完;有漏洞的相依走 security updates,
是另一條路,不受這個 ignore 影響。
驗證
groups.github/;本倉庫只有 Markdown,沒有建置步驟,規範內容零變更事項:workspace
todo/安全加固與掃描自動化.mdGenerated by Claude Code