종속성 제출
REST API를 사용하여 종속성을 제출합니다.
종속성 제출 정보
참고: 종속성 제출에 REST API를 사용하는 기능은 현재 퍼블릭 베타 버전이며 변경될 수 있습니다.
REST API를 사용하여 프로젝트에 대한 종속성을 제출할 수 있습니다. 이를 통해 소프트웨어가 컴파일되거나 빌드될 때 확인된 종속성 등의 종속성을 GitHub의 종속성 그래프 기능에 추가하여 프로젝트의 모든 종속성을 보다 완벽하게 파악할 수 있습니다.
종속성 그래프는 리포지토리의 매니페스트 또는 잠금 파일(예: JavaScript 프로젝트의 package-lock.json
파일)에서 식별되는 종속성 외에 API를 사용하여 제출하는 모든 종속성을 보여 줍니다. 종속성 그래프를 보는 방법에 대한 자세한 내용은 "AUTOTITLE"을 참조하세요.
제출된 종속성은 알려진 취약성에 대해 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.
"Create a snapshot of dependencies for a repository"에 대한 매개 변수
헤더 | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
속성, 형식, Description | ||||||||||||||||||||||||||||||||||||
accept string Setting to | ||||||||||||||||||||||||||||||||||||
경로 매개 변수 | ||||||||||||||||||||||||||||||||||||
속성, 형식, Description | ||||||||||||||||||||||||||||||||||||
owner string 필수The account owner of the repository. The name is not case sensitive. | ||||||||||||||||||||||||||||||||||||
repo string 필수The name of the repository. The name is not case sensitive. | ||||||||||||||||||||||||||||||||||||
본문 매개 변수 | ||||||||||||||||||||||||||||||||||||
속성, 형식, Description | ||||||||||||||||||||||||||||||||||||
version integer 필수The version of the repository snapshot submission. | ||||||||||||||||||||||||||||||||||||
job object 필수 | ||||||||||||||||||||||||||||||||||||
Properties of |
속성, 형식, Description |
---|
id string 필수The external ID of the job. |
correlator string 필수Correlator 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 필수The commit SHA associated with this dependency snapshot. Maximum length: 40 characters.
ref
string 필수The repository branch that triggered this snapshot.
detector
object 필수A description of the detector used.
Properties of detector
속성, 형식, Description |
---|
name string 필수The name of the detector used. |
version string 필수The version of the detector used. |
url string 필수The 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
속성, 형식, Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
key object A user-defined key to represent an item in | ||||||||||||||||||||||||||||||
Properties of |
속성, 형식, Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
name string 필수The name of the manifest. | |||||||||||||||
file object | |||||||||||||||
Properties of |
속성, 형식, Description |
---|
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
속성, 형식, Description | |||||||||
---|---|---|---|---|---|---|---|---|---|
key object A user-defined key to represent an item in | |||||||||
Properties of |
속성, 형식, Description |
---|
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 필수The time at which the snapshot was scanned.
"Create a snapshot of dependencies for a repository"에 대한 HTTP 응답 상태 코드
상태 코드 | Description |
---|---|
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>"\
-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"
}