{"meta":{"title":"Dependabot バージョンの更新の構成","intro":"Dependabot が使用するパッケージを自動的に更新するようにリポジトリを設定できます。","product":"セキュリティとコードの品質","breadcrumbs":[{"href":"/ja/code-security","title":"セキュリティとコードの品質"},{"href":"/ja/code-security/how-tos","title":"やり方"},{"href":"/ja/code-security/how-tos/secure-your-supply-chain","title":"サプライ チェーンをセキュリティで保護する"},{"href":"/ja/code-security/how-tos/secure-your-supply-chain/secure-your-dependencies","title":"依存関係をセキュリティ保護する"},{"href":"/ja/code-security/how-tos/secure-your-supply-chain/secure-your-dependencies/configuring-dependabot-version-updates","title":"バージョン更新の構成"}],"documentType":"article"},"body":"# Dependabot バージョンの更新の構成\n\nDependabot が使用するパッケージを自動的に更新するようにリポジトリを設定できます。\n\n<!--Marketing-LINK: From /features/security/software-supply-chain page \"About version updates for dependencies\".-->\n\n## Dependabot version updates を有効化する\n\n```\n          `dependabot.yml` 構成ファイルをリポジトリにコミットして、Dependabot version updates を有効にします。\n```\n\n設定ページでこの機能を有効にした場合、GitHub によって編集可能な基本ファイルが作成されます。それ以外の場合は、任意のファイル エディターを使用してファイルを作成できます。\n\n1. GitHub で、リポジトリのメイン ページに移動します。\n\n2. リポジトリ名の下にある **<svg version=\"1.1\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" class=\"octicon octicon-gear\" aria-label=\"gear\" role=\"img\"><path d=\"M8 0a8.2 8.2 0 0 1 .701.031C9.444.095 9.99.645 10.16 1.29l.288 1.107c.018.066.079.158.212.224.231.114.454.243.668.386.123.082.233.09.299.071l1.103-.303c.644-.176 1.392.021 1.82.63.27.385.506.792.704 1.218.315.675.111 1.422-.364 1.891l-.814.806c-.049.048-.098.147-.088.294.016.257.016.515 0 .772-.01.147.038.246.088.294l.814.806c.475.469.679 1.216.364 1.891a7.977 7.977 0 0 1-.704 1.217c-.428.61-1.176.807-1.82.63l-1.102-.302c-.067-.019-.177-.011-.3.071a5.909 5.909 0 0 1-.668.386c-.133.066-.194.158-.211.224l-.29 1.106c-.168.646-.715 1.196-1.458 1.26a8.006 8.006 0 0 1-1.402 0c-.743-.064-1.289-.614-1.458-1.26l-.289-1.106c-.018-.066-.079-.158-.212-.224a5.738 5.738 0 0 1-.668-.386c-.123-.082-.233-.09-.299-.071l-1.103.303c-.644.176-1.392-.021-1.82-.63a8.12 8.12 0 0 1-.704-1.218c-.315-.675-.111-1.422.363-1.891l.815-.806c.05-.048.098-.147.088-.294a6.214 6.214 0 0 1 0-.772c.01-.147-.038-.246-.088-.294l-.815-.806C.635 6.045.431 5.298.746 4.623a7.92 7.92 0 0 1 .704-1.217c.428-.61 1.176-.807 1.82-.63l1.102.302c.067.019.177.011.3-.071.214-.143.437-.272.668-.386.133-.066.194-.158.211-.224l.29-1.106C6.009.645 6.556.095 7.299.03 7.53.01 7.764 0 8 0Zm-.571 1.525c-.036.003-.108.036-.137.146l-.289 1.105c-.147.561-.549.967-.998 1.189-.173.086-.34.183-.5.29-.417.278-.97.423-1.529.27l-1.103-.303c-.109-.03-.175.016-.195.045-.22.312-.412.644-.573.99-.014.031-.021.11.059.19l.815.806c.411.406.562.957.53 1.456a4.709 4.709 0 0 0 0 .582c.032.499-.119 1.05-.53 1.456l-.815.806c-.081.08-.073.159-.059.19.162.346.353.677.573.989.02.03.085.076.195.046l1.102-.303c.56-.153 1.113-.008 1.53.27.161.107.328.204.501.29.447.222.85.629.997 1.189l.289 1.105c.029.109.101.143.137.146a6.6 6.6 0 0 0 1.142 0c.036-.003.108-.036.137-.146l.289-1.105c.147-.561.549-.967.998-1.189.173-.086.34-.183.5-.29.417-.278.97-.423 1.529-.27l1.103.303c.109.029.175-.016.195-.045.22-.313.411-.644.573-.99.014-.031.021-.11-.059-.19l-.815-.806c-.411-.406-.562-.957-.53-1.456a4.709 4.709 0 0 0 0-.582c-.032-.499.119-1.05.53-1.456l.815-.806c.081-.08.073-.159.059-.19a6.464 6.464 0 0 0-.573-.989c-.02-.03-.085-.076-.195-.046l-1.102.303c-.56.153-1.113.008-1.53-.27a4.44 4.44 0 0 0-.501-.29c-.447-.222-.85-.629-.997-1.189l-.289-1.105c-.029-.11-.101-.143-.137-.146a6.6 6.6 0 0 0-1.142 0ZM11 8a3 3 0 1 1-6 0 3 3 0 0 1 6 0ZM9.5 8a1.5 1.5 0 1 0-3.001.001A1.5 1.5 0 0 0 9.5 8Z\"></path></svg> \\[Settings]** をクリックします。 \\[設定] タブが表示されない場合は、 **\\[<svg version=\"1.1\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" class=\"octicon octicon-kebab-horizontal\" aria-label=\"More\" role=\"img\"><path d=\"M8 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM1.5 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm13 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z\"></path></svg>]** ドロップダウン メニューを選び、 **\\[設定]** をクリックします。\n\n   ![タブを示すリポジトリ ヘッダーのスクリーンショット。 \\[設定\\] タブが濃いオレンジ色の枠線で強調表示されています。](/assets/images/help/repository/repo-actions-settings.png)\n\n3. サイドバーの \\[Security] セクションで、**\\[<svg version=\"1.1\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" class=\"octicon octicon-codescan\" aria-label=\"codescan\" role=\"img\"><path d=\"M8.47 4.97a.75.75 0 0 0 0 1.06L9.94 7.5 8.47 8.97a.75.75 0 1 0 1.06 1.06l2-2a.75.75 0 0 0 0-1.06l-2-2a.75.75 0 0 0-1.06 0ZM6.53 6.03a.75.75 0 0 0-1.06-1.06l-2 2a.75.75 0 0 0 0 1.06l2 2a.75.75 0 1 0 1.06-1.06L5.06 7.5l1.47-1.47Z\"></path><path d=\"M12.246 13.307a7.501 7.501 0 1 1 1.06-1.06l2.474 2.473a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM1.5 7.5a6.002 6.002 0 0 0 3.608 5.504 6.002 6.002 0 0 0 6.486-1.117.748.748 0 0 1 .292-.293A6 6 0 1 0 1.5 7.5Z\"></path></svg> Advanced Security]** をクリックします。\n\n4. \\[Dependabot] で、\\[Dependabot version updates] の右側にある **\\[Enable]** をクリックして、リポジトリの `dependabot.yml` ディレクトリにある基本的な `.github` 構成ファイルを開きます。 For information about the options you can use to customize how Dependabot maintains your repositories, see [Dependabot オプション リファレンス](/ja/code-security/dependabot/working-with-dependabot/dependabot-options-reference).\n\n   ```yaml copy\n   # To get started with Dependabot version updates, you'll need to specify which\n   # package ecosystems to update and where the package manifests are located.\n\n   version: 2\n   updates:\n   - package-ecosystem: \"\" # See documentation for possible values\n     directory: \"/\" # Location of package manifests\n     schedule:\n       interval: \"weekly\"\n   ```\n\n5. ```\n          `version` を追加します。 この鍵は必須です。 このファイルは `version: 2` で始まる必要があります。\n   ```\n\n6. プライベート レジストリに依存関係がある場合は、必要に応じて、認証情報が含まれている `registries` セクションを追加します。 詳しくは、「[Dependabot のプライベート レジストリへのアクセスの構成](/ja/code-security/dependabot/working-with-dependabot/configuring-access-to-private-registries-for-dependabot)」をご覧ください。\n\n7. ```\n          `updates` セクションを追加し、Dependabot で監視したい各パッケージ モニターのエントリを追加します。 この鍵は必須です。 これを使用することで、Dependabot がバージョンやプロジェクトの依存性を更新する方法を設定できます。 各エントリは、特定のパッケージマネージャーの更新設定を行います。 詳細については、「[AUTOTITLE](/code-security/concepts/supply-chain-security/about-the-dependabot-yml-file)」および「[AUTOTITLE](/code-security/dependabot/working-with-dependabot/dependabot-options-reference)」を参照してください。\n   ```\n\n8. パッケージマネージャーごとに、以下を使用します。\n\n   * `package-ecosystem`: パッケージ マネージャーを指定します。 サポートされているパッケージ マネージャーの詳細については、「[`package-ecosystem`](/ja/code-security/dependabot/working-with-dependabot/dependabot-options-reference#package-ecosystem-)」を参照してください。\n   * `directories` または `directory`: マニフェストや他の定義ファイルの場所を指定します。 詳細については、「[マニフェスト ファイルの複数の場所を定義する](/ja/code-security/dependabot/dependabot-version-updates/controlling-dependencies-updated#defining-multiple-locations-for-manifest-files)」を参照してください。\n   * `schedule.interval`: 新しいバージョンをチェックする頻度を指定します。\n\n9. リポジトリの `.github` ディレクトリにある *dependabot.yml* 構成ファイルを確認します。\n\n###\n\n```\n          `dependabot.yml` ファイルの例\n```\n\n次の `dependabot.yml` ファイル例では、npm、Docker、GitHub Actions という 3 つのパッケージ マネージャーのバージョン更新プログラムを構成しています。 このファイルがチェックインされると、Dependabot が、デフォルトブランチのマニフェストファイルで古い依存関係がないかをチェックします。 古い依存関係が見つかった場合、デフォルトブランチに対してプルリクエストを発行して依存関係を更新します。\n\n```yaml copy\n# Basic `dependabot.yml` file with\n# minimum configuration for three package managers\n\nversion: 2\nupdates:\n  # Enable version updates for npm\n  - package-ecosystem: \"npm\"\n    # Look for `package.json` and `lock` files in the `root` directory\n    directory: \"/\"\n    # Check the npm registry for updates every day (weekdays)\n    schedule:\n      interval: \"daily\"\n\n  # Enable version updates for Docker\n  - package-ecosystem: \"docker\"\n    # Look for a `Dockerfile` in the `root` directory\n    directory: \"/\"\n    # Check for updates once a week\n    schedule:\n      interval: \"weekly\"\n\n  # Enable version updates for GitHub Actions\n  - package-ecosystem: \"github-actions\"\n    # Workflow files stored in the default location of `.github/workflows`\n    # You don't need to specify `/.github/workflows` for `directory`. You can use `directory: \"/\"`.\n    directory: \"/\"\n    schedule:\n      interval: \"weekly\"\n```\n\n上記の例では、Docker の依存関係がとても古い場合、その依存関係が最新の状態になるまで、まずは `daily` (毎日) スケジュールを設定して、その後 Weekly (毎週) スケジュールに戻すことができます。\n\n## フォークのバージョン更新を有効にする\n\nフォークでバージョン更新を有効にする場合は、追加の手順があります。\n`dependabot.yml` 構成ファイルが存在していると、フォークでのバージョン アップデートが自動的に有効になることはありません。 これにより、元のリポジトリからの `dependabot.yml` 構成ファイルを含む変更をプルするときに、フォーク所有者が意図せずバージョン アップデートを有効にしてしまうことがなくなります。\n\nフォークでは、Dependabot を明示的に有効にする必要もあります。\n\n1. GitHub で、リポジトリのメイン ページに移動します。\n2. リポジトリ名の下にある **<svg version=\"1.1\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" class=\"octicon octicon-gear\" aria-label=\"gear\" role=\"img\"><path d=\"M8 0a8.2 8.2 0 0 1 .701.031C9.444.095 9.99.645 10.16 1.29l.288 1.107c.018.066.079.158.212.224.231.114.454.243.668.386.123.082.233.09.299.071l1.103-.303c.644-.176 1.392.021 1.82.63.27.385.506.792.704 1.218.315.675.111 1.422-.364 1.891l-.814.806c-.049.048-.098.147-.088.294.016.257.016.515 0 .772-.01.147.038.246.088.294l.814.806c.475.469.679 1.216.364 1.891a7.977 7.977 0 0 1-.704 1.217c-.428.61-1.176.807-1.82.63l-1.102-.302c-.067-.019-.177-.011-.3.071a5.909 5.909 0 0 1-.668.386c-.133.066-.194.158-.211.224l-.29 1.106c-.168.646-.715 1.196-1.458 1.26a8.006 8.006 0 0 1-1.402 0c-.743-.064-1.289-.614-1.458-1.26l-.289-1.106c-.018-.066-.079-.158-.212-.224a5.738 5.738 0 0 1-.668-.386c-.123-.082-.233-.09-.299-.071l-1.103.303c-.644.176-1.392-.021-1.82-.63a8.12 8.12 0 0 1-.704-1.218c-.315-.675-.111-1.422.363-1.891l.815-.806c.05-.048.098-.147.088-.294a6.214 6.214 0 0 1 0-.772c.01-.147-.038-.246-.088-.294l-.815-.806C.635 6.045.431 5.298.746 4.623a7.92 7.92 0 0 1 .704-1.217c.428-.61 1.176-.807 1.82-.63l1.102.302c.067.019.177.011.3-.071.214-.143.437-.272.668-.386.133-.066.194-.158.211-.224l.29-1.106C6.009.645 6.556.095 7.299.03 7.53.01 7.764 0 8 0Zm-.571 1.525c-.036.003-.108.036-.137.146l-.289 1.105c-.147.561-.549.967-.998 1.189-.173.086-.34.183-.5.29-.417.278-.97.423-1.529.27l-1.103-.303c-.109-.03-.175.016-.195.045-.22.312-.412.644-.573.99-.014.031-.021.11.059.19l.815.806c.411.406.562.957.53 1.456a4.709 4.709 0 0 0 0 .582c.032.499-.119 1.05-.53 1.456l-.815.806c-.081.08-.073.159-.059.19.162.346.353.677.573.989.02.03.085.076.195.046l1.102-.303c.56-.153 1.113-.008 1.53.27.161.107.328.204.501.29.447.222.85.629.997 1.189l.289 1.105c.029.109.101.143.137.146a6.6 6.6 0 0 0 1.142 0c.036-.003.108-.036.137-.146l.289-1.105c.147-.561.549-.967.998-1.189.173-.086.34-.183.5-.29.417-.278.97-.423 1.529-.27l1.103.303c.109.029.175-.016.195-.045.22-.313.411-.644.573-.99.014-.031.021-.11-.059-.19l-.815-.806c-.411-.406-.562-.957-.53-1.456a4.709 4.709 0 0 0 0-.582c-.032-.499.119-1.05.53-1.456l.815-.806c.081-.08.073-.159.059-.19a6.464 6.464 0 0 0-.573-.989c-.02-.03-.085-.076-.195-.046l-1.102.303c-.56.153-1.113.008-1.53-.27a4.44 4.44 0 0 0-.501-.29c-.447-.222-.85-.629-.997-1.189l-.289-1.105c-.029-.11-.101-.143-.137-.146a6.6 6.6 0 0 0-1.142 0ZM11 8a3 3 0 1 1-6 0 3 3 0 0 1 6 0ZM9.5 8a1.5 1.5 0 1 0-3.001.001A1.5 1.5 0 0 0 9.5 8Z\"></path></svg> \\[Settings]** をクリックします。 \\[設定] タブが表示されない場合は、 **\\[<svg version=\"1.1\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" class=\"octicon octicon-kebab-horizontal\" aria-label=\"More\" role=\"img\"><path d=\"M8 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM1.5 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm13 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z\"></path></svg>]** ドロップダウン メニューを選び、 **\\[設定]** をクリックします。\n\n   ![タブを示すリポジトリ ヘッダーのスクリーンショット。 \\[設定\\] タブが濃いオレンジ色の枠線で強調表示されています。](/assets/images/help/repository/repo-actions-settings.png)\n3. サイドバーの \\[Security] セクションで、**\\[<svg version=\"1.1\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" class=\"octicon octicon-codescan\" aria-label=\"codescan\" role=\"img\"><path d=\"M8.47 4.97a.75.75 0 0 0 0 1.06L9.94 7.5 8.47 8.97a.75.75 0 1 0 1.06 1.06l2-2a.75.75 0 0 0 0-1.06l-2-2a.75.75 0 0 0-1.06 0ZM6.53 6.03a.75.75 0 0 0-1.06-1.06l-2 2a.75.75 0 0 0 0 1.06l2 2a.75.75 0 1 0 1.06-1.06L5.06 7.5l1.47-1.47Z\"></path><path d=\"M12.246 13.307a7.501 7.501 0 1 1 1.06-1.06l2.474 2.473a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM1.5 7.5a6.002 6.002 0 0 0 3.608 5.504 6.002 6.002 0 0 0 6.486-1.117.748.748 0 0 1 .292-.293A6 6 0 1 0 1.5 7.5Z\"></path></svg> Advanced Security]** をクリックします。\n4. \\[Dependabot] で、\\[Dependabot version updates] の右側にある **\\[有効化]** をクリックして、Dependabot にバージョン更新プログラムを開始するのを許可します。\n\n## 間接依存関係の更新プログラムの受信\n\n既定では、マニフェストで明示的に定義されている直接の依存関係のみが、Dependabot version updates によって最新の状態に保たれます。 ロック ファイルで定義されている間接的な依存関係に対する更新を受け取ることができます。 詳しくは、「[Dependabot が更新する依存関係を制御する](/ja/code-security/dependabot/dependabot-version-updates/controlling-dependencies-updated#allowing-specific-dependencies-to-be-updated)」をご覧ください。\n\n## プライベート依存関係へのアクセスの有効化\n\nセキュリティあるいはバージョンアップデートを実行する際に、エコシステムによってはアップデートが成功したことを検証するためにすべての依存関係をソースから解決できなければならないことがあります。 マニフェストあるいはロックファイルにプライベートの依存関係が含まれているなら、Dependabotはそれらの依存関係がホストされている場所にアクセスできなければなりません。 Organizationのオーナーは、同じOrganization内のプロジェクトに対する依存関係を含むプライベートリポジトリへのアクセス権をDependabotに付与できます。 詳しくは、「[組織のセキュリティおよび分析設定を管理する](/ja/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/managing-security-and-analysis-settings-for-your-organization#allowing-dependabot-to-access-private-dependencies)」をご覧ください。 リポジトリの `dependabot.yml` 構成ファイルで、プライベート レジストリへのアクセスを構成できます。 詳しくは、「[Dependabot のプライベート レジストリへのアクセスの構成](/ja/code-security/dependabot/working-with-dependabot/configuring-access-to-private-registries-for-dependabot)」をご覧ください。\n\nさらに、Dependabot は、すべてのパッケージ マネージャーに対してプライベートな GitHub 依存関係をサポートしません。 詳細については、「[Dependabot でサポートされているエコシステムとリポジトリ](/ja/code-security/dependabot/ecosystems-supported-by-dependabot/supported-ecosystems-and-repositories)」および「[GitHub言語のサポート](/ja/get-started/learning-about-github/github-language-support)」を参照してください。\n\n## バージョン更新のステータスを確認する\n\nバージョン アップデートを有効にすると、リポジトリの依存関係グラフにある **\\[Dependabot]** タブが設定されます。 このタブには、Dependabot が監視するように設定されているパッケージマネージャーと、Dependabot が最後に新しいバージョンをチェックした日時が表示されます。\n\n![\\[依存関係グラフ\\] ページのスクリーンショット。 \"Dependabot\" というタイトルのタブが、オレンジ色の枠線で強調表示されています。](/assets/images/help/dependabot/dependabot-tab-view.png)\n\n詳しくは、「[バージョン更新用に設定された依存関係を一覧表示する](/ja/code-security/dependabot/troubleshooting-dependabot/listing-dependencies-configured-for-version-updates)」を参照してください。\n\n## Dependabot version updates を無効にする\n\nリポジトリから `dependabot.yml` ファイルを削除することで、バージョン アップデートを完全に無効にすることができます。 通常、1 つ以上の依存関係やパッケージマネージャーの更新を一時的に無効にする必要がある場合があります。\n\n* パッケージ マネージャー: 構成ファイル内で `open-pull-requests-limit: 0` を設定するか、関連する `package-ecosystem` をコメントアウトして無効にします。\n* 特定の依存関係: アップデートから除外したいパッケージまたはアプリケーションの `ignore` 属性を追加して無効にします。\n\n依存関係を無効にすると、ワイルドカードを使用して、関連する一連のライブラリを照合できます。 除外するバージョンを指定することもできます。 これは、ライブラリの更新をブロックする必要がある場合や、API の重大な変更をサポートするために作業を保留する必要があるが、使用するバージョンのセキュリティ修正を取得する場合に特に便利です。\n\n### 一部の依存関係のバージョン更新を無効にする例\n\n次の `dependabot.yml` ファイルの例には、別の方法で一部の依存関係の更新を無効にしながら他の更新を引き続き行うことができるようにする例が含まれています。\n\n```yaml\n# `dependabot.yml` file with updates\n# disabled for Docker and limited for npm\n\nversion: 2\nupdates:\n  # Configuration for Dockerfile\n  - package-ecosystem: \"docker\"\n    directory: \"/\"\n    schedule:\n      interval: \"weekly\"\n      # Disable all pull requests for Docker dependencies\n    open-pull-requests-limit: 0\n\n  # Configuration for npm\n  - package-ecosystem: \"npm\"\n    directory: \"/\"\n    schedule:\n      interval: \"weekly\"\n    ignore:\n      # Ignore updates to packages that start with 'aws'\n      # Wildcards match zero or more arbitrary characters\n      - dependency-name: \"aws*\"\n      # Ignore some updates to the 'express' package\n      - dependency-name: \"express\"\n        # Ignore only new versions for 4.x and 5.x\n        versions: [\"4.x\", \"5.x\"]\n      # For all packages, ignore all patch updates\n      - dependency-name: \"*\"\n        update-types: [\"version-update:semver-patch\"]\n```\n\n既存の無視設定の確認について詳しくは、「[Dependabot オプション リファレンス](/ja/code-security/dependabot/working-with-dependabot/dependabot-options-reference#ignore--)」を参照してください。"}