Skip to main content

Dependency graph

You can use the dependency graph to identify all your project's dependencies. The dependency graph supports a range of popular package ecosystems.

谁可以使用此功能?

依赖项关系图适用于以下存储库类型:

  • 公共存储库(默认打开)
  • 私有仓库
  • 前叉

About the dependency graph

依赖项关系图是存储在存储库中的清单和锁定文件以及使用 依赖项提交 API 提交给存储库的任何依赖项的摘要。 对于每个存储库,它显示:

  • 依赖项、它依赖的生态系统和包
  • 依赖项,是指依赖于它的存储库和包

对于每个依赖项,可以看到版本、许可证信息、包含它的清单文件,以及它是否具有已知漏洞。 对于支持传递性依赖项的包生态系统,将显示依赖关系状态。你可以单击 ,然后选择“Show paths”,以查看引入该依赖项的传递路径。

还可以使用搜索栏搜索特定依赖项。 依赖项会自动排序,存在漏洞的包排在最上方。

For information on the supported ecosystems and manifest files, see 依赖项关系图支持的包生态系统.

When you create a pull request containing changes to dependencies that targets the default branch, GitHub uses the dependency graph to add dependency reviews to the pull request. These indicate whether the dependencies contain vulnerabilities and, if so, the version of the dependency in which the vulnerability was fixed. For more information, see Dependency review.

How the dependency graph is built

The dependency graph automatically parses dependencies by analyzing manifests and lock files in your repository. You can also submit data yourself. For more information, see 依赖项图如何识别依赖项.

Dependency graph availability

存储库管理员可以启用或禁用存储库的依赖关系图。 For more information, see 管理存储库的安全和分析设置.

存储库管理员可以启用或禁用存储库的依赖关系图。 See Enabling the dependency graph.

Dependents and "used by" data

For public repositories, the dependency graph lists dependents. These are other public repositories that depend on the repository or on packages that it publishes. This information is not reported for private repositories.

某些存储库在“ 代码 ”选项卡的边栏中有一个“使用者”部分。本部分显示对找到的包的公共引用数,并显示依赖项目的一些所有者的头像。 Clicking any item in this section takes you to the Dependents tab of the dependency graph.

Your repository will have a "Used by" section if:

  • The dependency graph is enabled for the repository.
  • Your repository contains a package that is published on a supported package ecosystem. See 依赖项关系图支持的包生态系统.
  • Within the ecosystem, your package has a link to a public repository where the source is stored.
  • More than 100 repositories depend on your package.

Screenshot of the "Used by" section for a repository showing the summary of "13.4m" with details of 8 avatars and "+13,435,819."

The "Used by" section represents a single package from the repository. If you have admin permissions to a repository that contains multiple packages, you can choose which package the "Used by" section represents. See 更改存储库的“使用者”数据.

What you can do with the dependency graph

You can use the dependency graph to:

Further reading