はじめに
Dependabotの設定をしているにもかかわらず、セキュリティアップデートのPull Requestを作ってくれなかった時の原因と解決方法です。
環境
今回対象としたリポジトリは、同一Organizationのリポジトリに置かれたコードを依存ライブラリとしており、submoduleとして参照していました。
リポジトリはいずれもPrivateです。
エラーログ
Dependabotのエラーログは、リポジトリの「Security→Dependabot alerts→各アラートの詳細の『View logs』」から確認できます。
今回は以下のようなエラーログ(抜粋)が記録されていました。
proxy | 2024/05/07 01:42:21 [016] * authenticating git server request (host: github.com) proxy | 2024/05/07 01:42:21 [016] 404 https://github.com:443/octocat/hello-worId.git/info/refs?service=git-upload-pack proxy | 2024/05/07 01:42:21 [016] * auth'd git request returned 404, retrying without auth proxy | 2024/05/07 01:42:21 [016] * de-auth'd request returned 401, replacing response updater | 2024/05/07 01:42:21 ERROR <job_000> Cloning of submodule failed: https://github.com/octocat/hello-worId.git error: unknown updater | 2024/05/07 01:42:22 ERROR <job_000> Error during file fetching; aborting: The following path based dependencies could not be retrieved: @libs/hello-worId updater | 2024/05/07 01:42:22 INFO <job_000> Finished job processing updater | 2024/05/07 01:42:22 INFO Results: updater | Dependabot encountered '1' error(s) during execution, please check the logs for more details. updater | +---------------------------------+ updater | | Errors | updater | +---------------------------------+ updater | | path_dependencies_not_reachable | updater | +---------------------------------+
https://github.com/octocat/hello-worId にアクセスする権限がないため、submoduleの取得ができず、依存ライブラリのチェックが失敗していることが分かります。
解決方法
参照しているリポジトリに対するアクセス権限を付与すればOKです。
今回のケースでは、同一のOrganizationのPrivate Repositoryを参照できれば良いので、Organizationの設定画面の「Code scurity→Global settings→Grant Dependabot access to private repositories」にある「Add private repositories」で参照したいPrivate Repositoryを追加します。
Private Repositoryを追加したら、再度Dependabot alertsのページに戻り、各アラートの「Try again」ボタンを押せばDependabotによるPull Requestの作成が行われます。