Skip to main content

此版本的 GitHub Enterprise Server 已于以下日期停止服务 2024-09-25. 即使针对重大安全问题,也不会发布补丁。 为了获得更好的性能、更高的安全性和新功能,请升级到最新版本的 GitHub Enterprise。 如需升级帮助,请联系 GitHub Enterprise 支持

依赖项关系图支持的包生态系统

依赖项关系图支持各种生态系统。

关于依赖项关系图

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

GitHub Enterprise Server 不检索依赖项的授予许可信息,也不计算有关依赖项、存储库和依赖于存储库的包的信息。 有关详细信息,请参阅“关于依赖关系图”。

本文介绍了支持的生态系统有哪些。

支持的包生态系统

建议的格式明确定义哪些版本用于所有直接和所有间接依赖项。 如果使用这些格式,依赖项关系图会更准确。 它还反映当前的生成设置,并且使依赖项关系图能够报告直接和间接依赖项中的漏洞。

Package managerLanguagesRecommended formatsAll supported formats
CargoRustCargo.lockCargo.toml, Cargo.lock
ComposerPHPcomposer.lockcomposer.json, composer.lock
NuGet.NET languages (C#, F#, VB), C++.csproj, .vbproj, .nuspec, .vcxproj, .fsproj.csproj, .vbproj, .nuspec, .vcxproj, .fsproj, packages.config
GitHub Actions workflowsYAML.yml, .yaml.yml, .yaml
Go modulesGogo.modgo.mod
MavenJava, Scalapom.xmlpom.xml
npmJavaScriptpackage-lock.jsonpackage-lock.json, package.json
pipPythonrequirements.txt, pipfile.lockrequirements.txt, pipfile, pipfile.lock, setup.py
pubDartpubspec.lockpubspec.yaml, pubspec.lock
Python PoetryPythonpoetry.lockpoetry.lock, pyproject.toml
RubyGemsRubyGemfile.lockGemfile.lock, Gemfile, *.gemspec
Swift Package ManagerSwiftPackage.resolvedPackage.resolved
YarnJavaScriptyarn.lockpackage.json, yarn.lock

Notes:

  • If you list your Python dependencies within a setup.py file, we may not be able to parse and list every dependency in your project.

  • GitHub Actions workflows must be located in the .github/workflows/ directory of a repository to be recognized as manifests. Any actions or workflows referenced using the syntax jobs[*].steps[*].uses or jobs.<job_id>.uses will be parsed as dependencies. For more information, see "GitHub Actions 的工作流语法."

  • Dependabot 只会为使用语义版本控制的易受攻击的 GitHub Actions 创建 Dependabot alerts。 你将不会收到有关使用 SHA 版本控制的易受攻击操作的警报。 如果将 GitHub Actions 与 SHA 版本控制配合使用,建议为存储库或组织启用 Dependabot version updates 以保留更新到最新版本的操作。 For more information, see "关于 Dependabot 警报" and "关于 Dependabot 版本更新."

通过依赖项提交操作支持的包生态系统

可以使用 依赖项提交 API 将生成时依赖项添加到依赖项关系图,或者将选择的包管理器和生态系统的依赖项添加到依赖项关系图,即使该生态系统不在上面支持的生态系统列表中。 这些提交的依赖项中的依赖项信息会依次流入 Dependabot updates 和 Dependabot alerts。

依赖项关系图将显示按生态系统分组的已提交依赖项,但与从清单或锁定文件解析的依赖项是分开的。 有关 依赖项提交 API 的详细信息,请参阅“使用依赖项提交 API”。

你通常在 GitHub Actions 工作流中使用 依赖项提交 API,从而在生成项目时提交项目的依赖项。 使用 依赖项提交 API 最简单的方法是向存储库添加预创建的操作,该操作将收集依赖项列表并将它转换为所需的快照格式,然后将此列表提交到 API。 可以在下表中找到指向当前可用操作的链接。

生态系统操作
GoGo 依赖项提交
GradleGradle 依赖项提交
MavenMaven 依赖关系树依赖项提交
研磨Mill 依赖项提交
ScalaSbt 依赖项提交
NuGet 及其他组件检测依赖项提交操作

注意:**** 对于组件检测依赖项提交操作,其他受支持的生态系统包括 Vcpkg、Conan、Conda、Crates 以及 NuGet。

例如,以下 Go 依赖项提交工作流将计算 Go 生成目标(带有 main 函数的 Go 文件)的依赖项,并将列表提交到 依赖项提交 API。

name: Go Dependency Submission
on:
  push:
    branches:
      - main

# The API requires write permission on the repository to submit dependencies
permissions:
  contents: write

# Environment variables to configure Go and Go modules. Customize as necessary
env:
  GOPROXY: '' # A Go Proxy server to be used
  GOPRIVATE: '' # A list of modules are considered private and not requested from GOPROXY
jobs:
  go-action-detection:
    runs-on: ubuntu-latest
    steps:
      - name: 'Checkout Repository'
        uses: actions/checkout@v4

      - uses: actions/setup-go@v5
        with:
          go-version: ">=1.18.0"

      - name: Run snapshot action
        uses: actions/go-dependency-submission@v1
        with:
            # Required: Define the repo path to the go.mod file used by the
            # build target
            go-mod-path: go-example/go.mod
            #
            # Optional. Define the repo path of a build target,
            # a file with a `main()` function.
            # If undefined, this action will collect all dependencies
            # used by all build targets for the module. This may
            # include Go dependencies used by tests and tooling.
            go-build-target: go-example/cmd/octocat.go

还可以创建自己的操作。 有关详细信息,请参阅“使用依赖项提交 API”。