종속성 제출
REST API를 사용하여 종속성을 제출합니다.
종속성 제출 정보
참고: 종속성 제출에 REST API를 사용하는 기능은 현재 퍼블릭 베타 버전이며 변경될 수 있습니다.
REST API를 사용하여 프로젝트에 대한 종속성을 제출할 수 있습니다. 이를 통해 소프트웨어가 컴파일되거나 빌드될 때 확인된 종속성 등의 종속성을 GitHub의 종속성 그래프 기능에 추가하여 프로젝트의 모든 종속성을 보다 완벽하게 파악할 수 있습니다.
종속성 그래프는 리포지토리의 매니페스트 또는 잠금 파일(예: JavaScript 프로젝트의 package-lock.json
파일)에서 식별되는 종속성 외에 API를 사용하여 제출하는 모든 종속성을 보여 줍니다. 종속성 그래프를 보는 방법에 대한 자세한 내용은 “리포지토리의 종속성 탐색”을 참조하세요.
제출된 종속성은 알려진 취약성에 대해 Dependabot alerts 및 Dependabot security updates를 받게 됩니다. GitHub Advisory Database의 지원되는 에코시스템 중 하나에서 발생한 종속성에 대한 Dependabot alerts만 가져옵니다. 제출된 종속성은 종속성 검토 또는 조직의 종속성 인사이트에 표시되지 않습니다.
스냅샷 형식으로 종속성을 제출할 수 있습니다. 스냅샷은 커밋 SHA 및 기타 메타데이터와 연결된 종속성 집합으로, 커밋에 대한 리포지토리의 현재 상태를 반영합니다. 프로젝트를 빌드할 때마다 미리 만들어진 작업을 사용하거나 고유한 작업을 만들어 필요한 형식으로 종속성을 제출할 수 있습니다. 자세한 내용은 "종속성 제출 API 사용"을 참조하세요.
종속성 그래프에 포함할 여러 종속성 집합을 제출할 수 있습니다. REST API는 스냅샷의 속성 및 detector.name
범주를 사용하여 job.correlator
각 워크플로에 대한 최신 제출이 표시되도록 합니다. correlator
속성 자체는 독립적인 제출을 고유하게 유지하는 데 사용하는 기본 필드입니다. 예를 들어 correlator
은 작업 실행 <GITHUB_WORKFLOW> <GITHUB_JOB>
에서 사용할 수 있는 두 변수의 간단한 조합일 수 있습니다.
Create a snapshot of dependencies for a repository
Create a new snapshot of a repository's dependencies. You must authenticate using an access token with the repo
scope to use this endpoint for a repository that the requesting user has access to.
Parameters
Headers | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
속성, Type, Description | ||||||||||||||||||||||||||||||||||||
accept stringSetting to | ||||||||||||||||||||||||||||||||||||
Path parameters | ||||||||||||||||||||||||||||||||||||
속성, Type, Description | ||||||||||||||||||||||||||||||||||||
owner stringRequiredThe account owner of the repository. The name is not case sensitive. | ||||||||||||||||||||||||||||||||||||
repo stringRequiredThe name of the repository. The name is not case sensitive. | ||||||||||||||||||||||||||||||||||||
Body parameters | ||||||||||||||||||||||||||||||||||||
속성, Type, Description | ||||||||||||||||||||||||||||||||||||
version integerRequiredThe version of the repository snapshot submission. | ||||||||||||||||||||||||||||||||||||
job objectRequired | ||||||||||||||||||||||||||||||||||||
Properties of |
속성, Type, Description |
---|
id stringRequiredThe external ID of the job. |
correlator stringRequiredCorrelator provides a key that is used to group snapshots submitted over time. Only the "latest" submitted snapshot for a given combination of |
html_url stringThe url for the job. |
sha
stringRequiredThe commit SHA associated with this dependency snapshot. Maximum length: 40 characters.
ref
stringRequiredThe repository branch that triggered this snapshot.
detector
objectRequiredA description of the detector used.
Properties of detector
속성, Type, Description |
---|
name stringRequiredThe name of the detector used. |
version stringRequiredThe version of the detector used. |
url stringRequiredThe url of the detector used. |
metadata
objectUser-defined metadata to store domain-specific information limited to 8 keys with scalar values.
manifests
objectA 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, Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
key objectA user-defined key to represent an item in | ||||||||||||||||||||||||||||||
Properties of |
속성, Type, Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
name stringRequiredThe name of the manifest. | |||||||||||||||
file object | |||||||||||||||
Properties of |
속성, Type, Description |
---|
source_location stringThe path of the manifest file relative to the root of the Git repository. |
metadata
objectUser-defined metadata to store domain-specific information limited to 8 keys with scalar values.
resolved
objectA collection of resolved package dependencies.
Properties of resolved
속성, Type, Description | |||||||||
---|---|---|---|---|---|---|---|---|---|
key objectA user-defined key to represent an item in | |||||||||
Properties of |
속성, Type, Description |
---|
package_url stringPackage-url (PURL) of dependency. See https://github.com/package-url/purl-spec for more details. |
metadata objectUser-defined metadata to store domain-specific information limited to 8 keys with scalar values. |
relationship stringA notation of whether a dependency is requested directly by this manifest or is a dependency of another dependency. Can be one of: |
scope stringA 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. Can be one of: |
dependencies array of stringsArray of package-url (PURLs) of direct child dependencies. |
scanned
stringRequiredThe time at which the snapshot was scanned.
HTTP response status codes
Status code | Description |
---|---|
201 | Created |
Code samples
curl \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>"\
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/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
Status: 201
{
"id": 12345,
"created_at": "2018-05-04T01:14:52Z",
"message": "Dependency results for the repo have been successfully updated.",
"result": "SUCCESS"
}