参考にさせていただいたページ
概要
基本的にマイクロソフトの「GitHub リポジトリで Dependabot セキュリティ アップデートを構成する - Learn | Microsoft Docs」を順を追って読んでいきながら設定するのが良さそうです。
Dependency graph(依存関係グラフ)
Dependency graph(依存関係グラフ)を有効化する
Dependency graph(依存関係グラフ)が有効化されていないとDependabotは有効化されないらしいので、「GitHub で依存関係を管理する - Learn | Microsoft Docs」に倣ってDependency graph(依存関係グラフ)を有効化します。
- 「Settings」 > サイドメニュー内のSecurityセクションの「Code security and analysis」 > Dependency graphの「Enable」ボタンをクリック
Dependency graph(依存関係グラフ)を表示する
一度確認しておくと良いでしょう。
- 「Insights」 > 「Dependency graph」 > いずれかのタブを選択
Dependabot alerts
Dependabot alertsを有効化する
- 「Settings」 > サイドメニュー内のSecurityセクションの「Code security and analysis」 > DependabotセクションのDependabot alertsの「Enable」ボタンをクリック
Dependabot alertsを表示する
- 「Security」 > 「Dependabot alerts」 の順にクリックすると一覧が表示されます。
Dependabot security updates
Dependabot security updatesを有効化する
- 「Settings」 > サイドメニュー内のSecurityセクションの「Code security and analysis」 > DependabotセクションのDependabot security updatesの「Enable」ボタンをクリック
たぶんこれで自動的にPull requestsが作成されるようになると思います。
Dependabot version updates
Dependabot version updatesを有効化する
- 「Settings」 > サイドメニュー内のSecurityセクションの「Code security and analysis」 > DependabotセクションのDependabot version updatesの「Enable」ボタンをクリック
そうすると、dependabot.yml作成ページに遷移します。
以下のdependabot.ymlのドキュメントなどを参考に記述してコミットすれば、自動的にPull requestsが作成されるようになると思います。
dependabot.ymlのドキュメント: 「https://docs.github.com/ja/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#about-the-dependabotyml-file」
記述内容としては例えば以下のような感じですが、pull requestsが大量に作成され過ぎるのでversion updatesは無効のままでも良いかもしれません。
package-ecosystem, directory, schedule.interval は必須らしいです。schedule.timezoneは必須ではありませんが記述しています。
# To get started with Dependabot version updates, you'll need to specify which # package ecosystems to update and where the package manifests are located. # Please see the documentation for all configuration options: # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates version: 2 updates: - package-ecosystem: "bundler" directory: "/rails" schedule: interval: "weekly" timezone: "Asia/Tokyo" - package-ecosystem: "npm" directory: "/frontend" schedule: interval: "weekly" timezone: "Asia/Tokyo"