Repository navigation
ci: Dependabot の更新を依存ごとの PR からグループ PR へまとめ、自動クローズを効かせる - #107
Merged
Merged
Conversation
group-by: dependency-name が作る部分グループ(gradle-builds/<依存名>)は設定に名前が無く、 既存 PR の更新ジョブがグループを引けない(dependabot/dependabot-core#14780、未解決)。 11-20 の定期実行は #102 / #103 を「別ジョブで更新する」として見送ったが、その更新ジョブは 起動せず、main で同じ版へ上げた後も両 PR はリベースもクローズもされずに残った。 部分グループを作らない通常のグループへ戻し、Kotlin 以外の更新を 1 本の PR で受ける。 通常のグループは複数ディレクトリを跨いで 1 本の PR になるため(kotlin グループと同じ)、 ディレクトリ跨ぎの二重 PR は引き続き生じない。Kotlin 系は先に宣言した kotlin グループへ 入るため、gradle-builds 側の exclude-patterns は外した。 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LPLYgbvcFcs2etHz17PPGk
アクションの更新は 1 件ずつ PR になり、同じ週に複数件が並んでいた(11-06 / 11-13 の #98・#99・#100)。Gradle 側と同じく 1 本のグループ PR で受ける。 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LPLYgbvcFcs2etHz17PPGk
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 が依存ごとに分かれて並ぶ状態と、main 側で版を上げても古い PR が閉じない状態を直す。
背景
自動クローズが効かない原因
Gradle の更新は
gradle-buildsグループにgroup-by: dependency-nameを付けていた。このとき Dependabot はgradle-builds/<依存名>という部分グループを実行時に作るが、その名前は設定に存在しない。既存 PR を更新する(リベース・不要ならクローズする)ジョブは設定からグループを引くため、部分グループの PR は扱えない(dependabot/dependabot-core#14780、未解決)。11-20 の定期実行(ログ)がまさにこの経路を通っている。ジョブ定義は ProjectMapK/sealed-class-enumizer#102 と ProjectMapK/sealed-class-enumizer#103 を既存のグループ PR として渡しており、updater は次のように両 PR を見送った。
この「別ジョブ」は起動しておらず、#104 で同じ版へ上げた後も両 PR は手で閉じるまで残った。個別 PR や通常のグループ PR は設定上の名前で更新ジョブへ渡せるため、他リポジトリで自動クローズが効いているのはこの差によるものと見ている。
PR が分かれる状態
Gradle は依存ごと、Actions はアクションごとに PR が出ており、11-13 の週は 1 回の定期実行で 4 本(#100〜#103)が並んだ。
変更
gradle-buildsを通常のグループ(patterns: ["*"])へ戻し、Kotlin 以外の更新を 1 本の PR で受ける。通常のグループも複数ディレクトリを跨いで 1 本の PR になるため(既存のkotlinグループと同じ。例: build(deps): Bump the kotlin group across 1 directory with 7 updates #71「Bump the kotlin group across 1 directory with 7 updates」)、group-byを入れた本来の目的であるディレクトリ跨ぎの二重 PR の解消は保たれるkotlinグループは別 PR のまま残す。配布版<KotlinVersion>-<自版>が変わり、同期タスクの追随やマイナー更新時の yarn.lock の作り直しを伴うため、他の定例更新とは分けて受けるgroups節)ため、先に宣言したkotlinが Kotlin 系を持つ。パターンを 2 か所で同期させる必要も無くなるgithub-actionsグループを足して 1 本の PR へまとめるversion updates の PR は週あたり最大 3 本(Kotlin/その他の Gradle/Actions)で、通常は 1〜2 本になる。
トレードオフ
グループ内の 1 件が CI を落とすと、同じ PR の他の更新も止まる(今回の ktfmt のようなケース)。その場合は #104 と同様に追随を別 PR で入れればよい。通常のグループは更新ジョブが効くため、main へ入った依存は次の定期実行でグループ PR から外れ、全件が入っていれば PR はクローズされる見込み。
検証
dependabot-2.0.jsonスキーマで.github/dependabot.ymlを検証(エラー 0 件)CI・設定のみの変更で配布物は変わらないため、CHANGELOG のエントリは無し。
🤖 Generated with Claude Code
https://claude.ai/code/session_01LPLYgbvcFcs2etHz17PPGk