이 버전의 GitHub Enterprise는 다음 날짜에 중단되었습니다. 2024-03-26. 중요한 보안 문제에 대해서도 패치 릴리스가 이루어지지 않습니다. 더 뛰어난 성능, 향상된 보안, 새로운 기능을 위해 최신 버전의 GitHub Enterprise Server로 업그레이드합니다. 업그레이드에 대한 도움말은 GitHub Enterprise 지원에 문의하세요.
종속성 제출에 대한 REST API 엔드포인트
REST API를 사용하여 종속성을 제출합니다.
About dependency submissions
Note: The ability to use the REST API for dependency submission is currently in public beta and subject to change.
You can use the REST API to submit dependencies for a project. This enables you to add dependencies, such as those resolved when software is compiled or built, to GitHub's dependency graph feature, providing a more complete picture of all of your project's dependencies.
The dependency graph shows any dependencies you submit using the API in addition to any dependencies that are identified from manifest or lock files in the repository (for example, a package-lock.json
file in a JavaScript project). For more information about viewing the dependency graph, see "Exploring the dependencies of a repository."
Submitted dependencies will receive Dependabot alerts and Dependabot security updates for any known vulnerabilities. You will only get Dependabot alerts for dependencies that are from one of the supported ecosystems for the GitHub Advisory Database. For more information about these ecosystems, see "About the GitHub Advisory database." For transitive dependencies submitted via the dependency submission API, Dependabot will automatically open pull requests to update the parent dependency, if an update is available.
Submitted dependencies will not be surfaced in dependency review or your organization's dependency insights.
You can submit dependencies in the form of a snapshot. A snapshot is a set of dependencies associated with a commit SHA and other metadata, that reflects the current state of your repository for a commit. You can choose to use pre-made actions or create your own actions to submit your dependencies in the required format each time your project is built. For more information, see "Using the dependency submission API."
You can submit multiple sets of dependencies to be included in your dependency graph. The REST API uses the job.correlator
property and the detector.name
category of the snapshot to ensure the latest submissions for each workflow get shown. The correlator
property itself is the primary field you will use to keep independent submissions distinct. An example correlator
could be a simple combination of two variables available in actions runs: <GITHUB_WORKFLOW> <GITHUB_JOB>
.
Create a snapshot of dependencies for a repository
Create a new snapshot of a repository's dependencies.
The authenticated user must have access to the repository.
OAuth app tokens and personal access tokens (classic) need the repo
scope to use this endpoint.
"Create a snapshot of dependencies for a repository"에 대한 매개 변수
이름, Type, 설명 |
---|
accept string Setting to |
이름, Type, 설명 |
---|
owner string RequiredThe account owner of the repository. The name is not case sensitive. |
repo string RequiredThe name of the repository without the |
이름, Type, 설명 | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
version integer RequiredThe version of the repository snapshot submission. | |||||||||||||||||||||
job object Required | |||||||||||||||||||||
Properties of |
이름, Type, 설명 |
---|
id string RequiredThe external ID of the job. |
correlator string RequiredCorrelator provides a key that is used to group snapshots submitted over time. Only the "latest" submitted snapshot for a given combination of |
html_url string The url for the job. |
sha
string RequiredThe commit SHA associated with this dependency snapshot. Maximum length: 40 characters.
ref
string RequiredThe repository branch that triggered this snapshot.
detector
object RequiredA description of the detector used.
Properties of detector
이름, Type, 설명 |
---|
name string RequiredThe name of the detector used. |
version string RequiredThe version of the detector used. |
url string RequiredThe url of the detector used. |
metadata
object User-defined metadata to store domain-specific information limited to 8 keys with scalar values.
manifests
object A collection of package manifests, which are a collection of related dependencies declared in a file or representing a logical group of dependencies.
Properties of manifests
이름, Type, 설명 | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
key object A user-defined key to represent an item in | ||||||||||||||||||
Properties of |
이름, Type, 설명 | |||||||||
---|---|---|---|---|---|---|---|---|---|
name string RequiredThe name of the manifest. | |||||||||
file object | |||||||||
Properties of |
이름, Type, 설명 |
---|
source_location string The path of the manifest file relative to the root of the Git repository. |
metadata
object User-defined metadata to store domain-specific information limited to 8 keys with scalar values.
resolved
object A collection of resolved package dependencies.
Properties of resolved
이름, Type, 설명 | ||||||
---|---|---|---|---|---|---|
key object A user-defined key to represent an item in | ||||||
Properties of |
이름, Type, 설명 |
---|
package_url string Package-url (PURL) of dependency. See https://github.com/package-url/purl-spec for more details. |
metadata object User-defined metadata to store domain-specific information limited to 8 keys with scalar values. |
relationship string A notation of whether a dependency is requested directly by this manifest or is a dependency of another dependency. 다음 중 하나일 수 있습니다.: |
scope string A notation of whether the dependency is required for the primary build artifact (runtime) or is only used for development. Future versions of this specification may allow for more granular scopes. 다음 중 하나일 수 있습니다.: |
dependencies array of strings Array of package-url (PURLs) of direct child dependencies. |
scanned
string RequiredThe time at which the snapshot was scanned.
"Create a snapshot of dependencies for a repository"에 대한 HTTP 응답 상태 코드
상태 코드 | 설명 |
---|---|
201 | Created |
"Create a snapshot of dependencies for a repository"에 대한 코드 샘플
요청 예제
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/dependency-graph/snapshots \
-d '{"version":0,"sha":"ce587453ced02b1526dfb4cb910479d431683101","ref":"refs/heads/main","job":{"correlator":"yourworkflowname_youractionname","id":"yourrunid"},"detector":{"name":"octo-detector","version":"0.0.1","url":"https://github.com/octo-org/octo-repo"},"scanned":"2022-06-14T20:25:00Z","manifests":{"package-lock.json":{"name":"package-lock.json","file":{"source_location":"src/package-lock.json"},"resolved":{"@actions/core":{"package_url":"pkg:/npm/%40actions/core@1.1.9","dependencies":["@actions/http-client"]},"@actions/http-client":{"package_url":"pkg:/npm/%40actions/http-client@1.0.7","dependencies":["tunnel"]},"tunnel":{"package_url":"pkg:/npm/tunnel@0.0.6"}}}}}'
Response