종속성 제출
종속성 제출 API를 사용하면 프로젝트에 대해 프로젝트를 빌드하거나 컴파일할 때 확인되는 종속성과 같은 종속성을 제출할 수 있습니다.
종속성 제출 API 정보
참고: 종속성 제출 API는 현재 퍼블릭 베타 버전이며 변경될 수 있습니다.
종속성 제출 API를 사용하면 프로젝트에 대한 종속성을 제출할 수 있습니다. 이를 통해 소프트웨어가 컴파일되거나 빌드될 때 확인된 종속성 등의 종속성을 GitHub의 종속성 그래프 기능에 추가하여 프로젝트의 모든 종속성을 보다 완벽하게 파악할 수 있습니다.
종속성 그래프는 리포지토리의 매니페스트 또는 잠금 파일(예: JavaScript 프로젝트의 package-lock.json 파일)에서 식별되는 종속성 외에 API를 사용하여 제출하는 모든 종속성을 보여 줍니다. 종속성 그래프를 보는 방법에 대한 자세한 내용은 “리포지토리의 종속성 탐색”을 참조하세요.
제출된 종속성은 알려진 취약성에 대해 Dependabot alerts 및 Dependabot security updates를 받게 됩니다. GitHub Advisory Database의 지원되는 에코시스템 중 하나에서 발생한 종속성에 대한 Dependabot alerts만 가져옵니다. 제출된 종속성은 종속성 검토 또는 조직의 종속성 인사이트에 표시되지 않습니다.
종속성은 스냅샷 형식으로 종속성 제출 API에 제출됩니다. 스냅샷은 커밋 SHA 및 기타 메타데이터와 연결된 종속성 집합으로, 커밋에 대한 리포지토리의 현재 상태를 반영합니다. 미리 만들어진 작업을 사용하거나 프로젝트를 빌드할 때마다 고유한 작업을 만들어 종속성을 필요한 형식으로 종속성 제출 API에 제출할 수 있습니다. 종속성 제출 API 사용에 대한 자세한 내용은 “종속성 제출 API 사용”을 참조하세요.
종속성 그래프에 포함할 종속성 제출 API에 여러 종속성 집합을 제출할 수 있습니다. 이 API는 스냅샷의 job.correlator 속성 및 detector.name 범주를 사용하여 각 워크플로에 대한 최신 제출이 표시되도록 합니다. 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.
매개 변수
| Headers | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Name, Type, Description | ||||||||||||||||||||||||||||||||||||
acceptstringSetting to | ||||||||||||||||||||||||||||||||||||
| Path parameters | ||||||||||||||||||||||||||||||||||||
| Name, Type, Description | ||||||||||||||||||||||||||||||||||||
ownerstringRequiredThe account owner of the repository. The name is not case sensitive. | ||||||||||||||||||||||||||||||||||||
repostringRequiredThe name of the repository. The name is not case sensitive. | ||||||||||||||||||||||||||||||||||||
| Body parameters | ||||||||||||||||||||||||||||||||||||
| Name, Type, Description | ||||||||||||||||||||||||||||||||||||
versionintegerRequiredThe version of the repository snapshot submission. | ||||||||||||||||||||||||||||||||||||
jobobjectRequired | ||||||||||||||||||||||||||||||||||||
Properties of | ||||||||||||||||||||||||||||||||||||
| Name, Type, Description |
|---|
idstringRequiredThe external ID of the job. |
correlatorstringRequiredCorrelator provides a key that is used to group snapshots submitted over time. Only the "latest" submitted snapshot for a given combination of |
html_urlstringThe url for the job. |
shastringRequiredThe commit SHA associated with this dependency snapshot. Maximum length: 40 characters.
refstringRequiredThe repository branch that triggered this snapshot.
detectorobjectRequiredA description of the detector used.
Properties of detector
| Name, Type, Description |
|---|
namestringRequiredThe name of the detector used. |
versionstringRequiredThe version of the detector used. |
urlstringRequiredThe url of the detector used. |
metadataobjectUser-defined metadata to store domain-specific information limited to 8 keys with scalar values.
manifestsobjectA 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
| Name, Type, Description | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
keyobjectA user-defined key to represent an item in | ||||||||||||||||||||||||||||||
Properties of | ||||||||||||||||||||||||||||||
| Name, Type, Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
namestringRequiredThe name of the manifest. | |||||||||||||||
fileobject | |||||||||||||||
Properties of | |||||||||||||||
| Name, Type, Description |
|---|
source_locationstringThe path of the manifest file relative to the root of the Git repository. |
metadataobjectUser-defined metadata to store domain-specific information limited to 8 keys with scalar values.
resolvedobjectA collection of resolved package dependencies.
Properties of resolved
| Name, Type, Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|
keyobjectA user-defined key to represent an item in | |||||||||
Properties of | |||||||||
| Name, Type, Description |
|---|
package_urlstringPackage-url (PURL) of dependency. See https://github.com/package-url/purl-spec for more details. |
metadataobjectUser-defined metadata to store domain-specific information limited to 8 keys with scalar values. |
relationshipstringA notation of whether a dependency is requested directly by this manifest or is a dependency of another dependency. Can be one of: |
scopestringA 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: |
dependenciesarray of stringsArray of package-url (PURLs) of direct child dependencies. |
scannedstringRequiredThe time at which the snapshot was scanned.
HTTP 응답 상태 코드
| 상태 코드 | 설명 |
|---|---|
201 | Created |
코드 샘플
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"
}

