依存関係グラフの利用
依存関係グラフは、サポートされているパッケージエコシステムで、サポートされているファイル形式を使って、パブリックリポジトリごとに利用できます。リポジトリ管理者は、プライベートリポジトリの依存関係グラフも設定できます。
依存関係グラフについて
The dependency graph is a summary of the manifest and lock files stored in a repository. For each repository, it shows:
- 依存関係、エコシステム、それが依存しているパッケージ
- Dependents, the repositories and packages that depend on it
When you push a commit to GitHub that changes or adds a supported manifest or lock file to the default branch, the dependency graph is automatically updated. In addition, the graph is updated when anyone pushes a change to the repository of one of your dependencies. For information on the supported ecosystems and manifest files, see "Supported package ecosystems" below.
含まれる依存関係
依存関係グラフには、サポートされているエコシステムについてマニフェストおよびロックファイル、または同等のもので詳細に定義されているリポジトリの依存関係がすべて含まれています。 これは以下のものが含まれます。
- マニフェストまたはロックファイルで明示的に定義されている、直接依存関係
- 直接依存関係の間接依存関係。推移的な依存関係、または下位の依存関係とも言う。
The dependency graph identifies indirect dependencies either explicitly from a lock file or by checking the dependencies of your direct dependencies. 最も信頼性の高いグラフを得るには、ロックファイル (または同等のもの) を使用してください。直接および間接の依存関係のうち現在どのバージョンを使用しているかが正確に定義されているからです。 If you use lock files, you also ensure that all contributors to the repository are using the same versions, which will make it easier for you to test and debug code.
Dependents included
For public repositories, only public repositories that depend on it or on packages that it publishes are reported. This information is not reported for private repositories.
依存関係グラフの使用
依存関係グラフを使用する目的は、次のとおりです。
- Explore the repositories your code depends on, and those that depend on it. For more information, see "Exploring the dependencies of a repository."
- Organization のリポジトリで使用されている依存関係のサマリーを 1 つのダッシュボードで確認すること。 詳細は「Organization のインサイトを表示する」を参照してください。
- リポジトリの脆弱な依存関係を表示・更新すること。 他の依存関係より前に、脆弱な依存関係がリストされます。 詳しい情報については、「脆弱性のある依存関係に対するアラートについて」を参照してください。
依存関係グラフの有効化
依存関係グラフを生成するには、GitHub がリポジトリの依存関係のマニフェストおよびロックファイルに読み取りアクセスできる必要があります。 依存関係グラフは、パブリックリポジトリに対しては常に自動的に生成され、プライベートリポジトリに対しては有効化を選択することができます。 For information about enabling or disabling it for private repositories, see "Exploring the dependencies of a repository."
依存関係グラフを初めて有効化すると、サポートされているエコシステムのマニフェストおよびロックファイルがすぐに解析されます。 グラフは通常数分以内に入力されますが、多くの依存関係を持つリポジトリの場合は時間がかかる場合があります。 Once enabled, the graph is automatically updated with every push to the repository and every push to other repositories in the graph.
サポートされているパッケージエコシステム
推奨されるフォーマットでは、直接および間接の依存関係すべてに使用されるバージョンを明示的に定義しています。 これらのフォーマットを使用したほうが、依存関係グラフは正確になります。 It also reflects the current build set up and enables the dependency graph to report vulnerabilities in both direct and indirect dependencies. Indirect dependencies that are inferred from a manifest file (or equivalent) are excluded from the checks for vulnerable dependencies.
| パッケージマネージャー | 言語 | 推奨されるフォーマット | サポートされているすべてのフォーマット |
|---|---|---|---|
| Composer | PHP | composer.lock | |
dotnet CLI | .NET 言語 (C#、C++、F#、VB) | .csproj、.vbproj、.nuspec、.vcxproj、.fsproj | .csproj、.vbproj、.nuspec、.vcxproj、.fsproj、packages.config |
| Maven | Java、Scala | pom.xml | pom.xml |
| npm | JavaScript | package-lock.json | package-lock.json、package.json |
| Python PIP | Python | requirements.txt、pipfile.lock | requirements.txt、pipfile.lock、setup.py* |
| RubyGems | Ruby | Gemfile.lock | Gemfile.lock、Gemfile、*.gemspec |
| Yarn | JavaScript | yarn.lock | package.json、yarn.lock |
メモ: setup.py ファイルで Python の依存関係をリストする場合、プロジェクトの依存関係すべてを解析してリストすることはできない場合があります。

