Dependabot setting
Dependabotの設定ファイル(.github/dependabot.yml)を生成するときに使用From its SKILL.md
npx -y skills add Doarakko/dotfiles --skill dependabot-settingAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
6.3 KB, as published. Nobody here has run it
Dependabot設定ファイル生成
リポジトリの構成を検出し、.github/dependabot.yml を生成する。
手順
1. リポジトリ解析
以下のファイルを検索し、使用されているパッケージエコシステムを検出する。
| ファイル | エコシステム |
|---|---|
package.json | npm |
requirements.txt, Pipfile, pyproject.toml, setup.py, setup.cfg | pip |
Gemfile | bundler |
go.mod | gomod |
pom.xml | maven |
build.gradle, build.gradle.kts | gradle |
Dockerfile, docker-compose.yml, docker-compose.yaml | docker |
.github/workflows/*.yml | github-actions |
*.tf | terraform |
composer.json | composer |
Cargo.toml | cargo |
2. スケジュール間隔の決定
git remote get-url origin からオーナーを取得し、リポジトリの種別を判定する。
- 個人リポジトリ:
interval: "monthly"を使用 - Organizationリポジトリ: ユーザーに希望するスケジュール間隔(
daily,weekly,monthly)を確認する
2.1. クールダウンの決定
クールダウンを設定するかユーザーに確認する。 参考: https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#cooldown
ユーザーがクールダウンを希望する場合、以下の値をユーザーに確認して決定する。
| パラメータ | 値の範囲 | 説明 |
|---|---|---|
default-days | 1〜90 | SemVerカテゴリに該当しない依存の待機日数 |
semver-major-days | 1〜90 | メジャーバージョン更新の待機日数 |
semver-minor-days | 1〜90 | マイナーバージョン更新の待機日数 |
semver-patch-days | 0〜90 | パッチバージョン更新の待機日数 |
注意事項:
- クールダウンはバージョン更新のみに適用され、セキュリティ更新には適用されない
- SemVer非対応のエコシステム(
github-actions,docker,terraform)にはdefault-daysのみ設定する
3. 既存設定の確認
.github/dependabot.ymlが既に存在する場合、内容を読み取りユーザーに上書き確認する
4. アプリケーション非影響の依存関係を特定
マニフェストファイルを読み取り、ビルド成果物に含まれないツール群を特定する。
以下のカテゴリに該当するもののみを development グループのパターンとする。
対象カテゴリ:
- linter(例:
eslint*,stylelint*,pylint*,flake8*,rubocop*,golangci-lint*) - formatter(例:
prettier*,black*,isort*) - 型定義(例:
@types/*) - テストツール(例:
jest*,vitest*,pytest*,rspec*,@testing-library/*) - Git hooks / CI補助(例:
husky*,lint-staged*,commitlint*)
必ずマニフェストに実在する依存のみをパターンに含めること。
5. 設定ファイル生成
グルーピングルール
development(アプリケーション非影響の依存関係):
- 手順4で特定したツール群を
patternsで明示指定:groups: development: patterns: - "eslint*" - "prettier*" - "@types/*" - "jest*"
GitHub Actions:
- 全アクションを1つのグループにまとめる:
groups: all-actions: patterns: - "*"
Terraform:
- 全プロバイダーを1つのグループにまとめる:
groups: all-providers: patterns: - "*"
クールダウン設定
手順2.1でクールダウンを設定する場合、各エコシステムに cooldown を追加する。
SemVer非対応のエコシステム(github-actions, docker, terraform)には default-days のみ設定する。
共通設定
schedule.interval: 手順2で決定した値cooldown: 手順2.1で決定した値(設定する場合)directory: マニフェストファイルが存在するディレクトリ(ルートなら"/")
6. 出力
.github/dependabot.ymlに書き出す.github/ディレクトリが存在しない場合は作成する- 生成した設定の概要をユーザーに表示する
生成例
クールダウンなし(個人リポジトリの場合)
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "monthly"
groups:
development:
patterns:
- "eslint*"
- "prettier*"
- "@types/*"
- "jest*"
- "@testing-library/*"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
groups:
all-actions:
patterns:
- "*"
- package-ecosystem: "terraform"
directory: "/"
schedule:
interval: "monthly"
groups:
all-providers:
patterns:
- "*"
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "monthly"
クールダウンあり
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
cooldown:
default-days: 3
semver-major-days: 14
semver-minor-days: 7
semver-patch-days: 3
groups:
development:
patterns:
- "eslint*"
- "prettier*"
- "@types/*"
- "jest*"
- "@testing-library/*"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
cooldown:
default-days: 7
groups:
all-actions:
patterns:
- "*"
絶対に守るべきルール
- 検出されたエコシステムのみ設定に含める(推測で追加しない)
- developmentグループにはマニフェストに実在するアプリケーション非影響の依存のみを含める
- 既存の
.github/dependabot.ymlがある場合は必ず確認してから上書きする - development・GitHub Actions・Terraformは必ずグルーピングする