Skip to main content

GitHub AE는 현재 제한된 릴리스 상태입니다.

최근에 REST API 설명서 중 일부를 이동했습니다. 원하는 내용을 찾을 수 없는 경우 새로운 Branches, Collaborators, Commits, Deploy Keys, Deployments, GitHub Pages, Releases, Metrics, Webhooks REST API 페이지를 사용해 볼 수 있습니다.

배포 분기 정책

REST API를 사용하여 사용자 지정 배포 분기 정책을 관리합니다.

배포 분기 정책 정보

REST API를 사용하여 환경에 배포하기 위해 분기가 일치해야 하는 사용자 지정 이름 패턴을 지정할 수 있습니다. 이러한 엔드포인트를 사용하려면 환경의 deployment_branch_policy.custom_branch_policies 속성이 true로 설정되어야 합니다. 환경에 대한 업데이트 deployment_branch_policy 는 "배포 환경.

환경 배포를 특정 분기로 제한하는 방법에 대한 자세한 내용은 "배포에 환경 사용.

List deployment branch policies

Works with GitHub Apps

Lists the deployment branch policies for an environment.

Anyone with read access to the repository can use this endpoint. If the repository is private, you must use an access token with the repo scope. GitHub Apps must have the actions:read permission to use this endpoint.

"List deployment branch policies"에 대한 매개 변수

머리글
이름, Type, 설명
accept string

Setting to application/vnd.github+json is recommended.

경로 매개 변수
이름, Type, 설명
owner string Required

The account owner of the repository. The name is not case sensitive.

repo string Required

The name of the repository without the .git extension. The name is not case sensitive.

environment_name string Required

The name of the environment. The name must be URL encoded. For example, any slashes in the name must be replaced with %2F.

쿼리 매개 변수
이름, Type, 설명
per_page integer

The number of results per page (max 100).

기본값: 30

page integer

Page number of the results to fetch.

기본값: 1

"List deployment branch policies"에 대한 HTTP 응답 상태 코드

상태 코드설명
200

OK

"List deployment branch policies"에 대한 코드 샘플

get/repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ https://HOSTNAME/api/v3/repos/OWNER/REPO/environments/ENVIRONMENT_NAME/deployment-branch-policies

Response

Status: 200
{ "total_count": 2, "branch_policies": [ { "id": 361471, "node_id": "MDE2OkdhdGVCcmFuY2hQb2xpY3kzNjE0NzE=", "name": "release/*" }, { "id": 361472, "node_id": "MDE2OkdhdGVCcmFuY2hQb2xpY3kzNjE0NzI=", "name": "main" } ] }

Create a deployment branch policy

Works with GitHub Apps

Creates a deployment branch or tag policy for an environment.

You must authenticate using an access token with the repo scope to use this endpoint. GitHub Apps must have the administration:write permission for the repository to use this endpoint.

"Create a deployment branch policy"에 대한 매개 변수

머리글
이름, Type, 설명
accept string

Setting to application/vnd.github+json is recommended.

경로 매개 변수
이름, Type, 설명
owner string Required

The account owner of the repository. The name is not case sensitive.

repo string Required

The name of the repository without the .git extension. The name is not case sensitive.

environment_name string Required

The name of the environment. The name must be URL encoded. For example, any slashes in the name must be replaced with %2F.

본문 매개 변수
이름, Type, 설명
name string Required

The name pattern that branches or tags must match in order to deploy to the environment.

Wildcard characters will not match /. For example, to match branches that begin with release/ and contain an additional single slash, use release/*/*. For more information about pattern matching syntax, see the Ruby File.fnmatch documentation.

type string

Whether this rule targets a branch or tag

다음 중 하나일 수 있습니다.: branch, tag

"Create a deployment branch policy"에 대한 HTTP 응답 상태 코드

상태 코드설명
200

OK

303

Response if the same branch name pattern already exists

404

Not Found or deployment_branch_policy.custom_branch_policies property for the environment is set to false

"Create a deployment branch policy"에 대한 코드 샘플

post/repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies
curl -L \ -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ https://HOSTNAME/api/v3/repos/OWNER/REPO/environments/ENVIRONMENT_NAME/deployment-branch-policies \ -d '{"name":"release/*"}'

Response

Status: 200
{ "id": 364662, "node_id": "MDE2OkdhdGVCcmFuY2hQb2xpY3kzNjQ2NjI=", "name": "release/*" }

Get a deployment branch policy

Works with GitHub Apps

Gets a deployment branch or tag policy for an environment.

Anyone with read access to the repository can use this endpoint. If the repository is private, you must use an access token with the repo scope. GitHub Apps must have the actions:read permission to use this endpoint.

"Get a deployment branch policy"에 대한 매개 변수

머리글
이름, Type, 설명
accept string

Setting to application/vnd.github+json is recommended.

경로 매개 변수
이름, Type, 설명
owner string Required

The account owner of the repository. The name is not case sensitive.

repo string Required

The name of the repository without the .git extension. The name is not case sensitive.

environment_name string Required

The name of the environment. The name must be URL encoded. For example, any slashes in the name must be replaced with %2F.

branch_policy_id integer Required

The unique identifier of the branch policy.

"Get a deployment branch policy"에 대한 HTTP 응답 상태 코드

상태 코드설명
200

OK

"Get a deployment branch policy"에 대한 코드 샘플

get/repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id}
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ https://HOSTNAME/api/v3/repos/OWNER/REPO/environments/ENVIRONMENT_NAME/deployment-branch-policies/BRANCH_POLICY_ID

Response

Status: 200
{ "id": 364662, "node_id": "MDE2OkdhdGVCcmFuY2hQb2xpY3kzNjQ2NjI=", "name": "release/*" }

Update a deployment branch policy

Works with GitHub Apps

Updates a deployment branch or tag policy for an environment.

You must authenticate using an access token with the repo scope to use this endpoint. GitHub Apps must have the administration:write permission for the repository to use this endpoint.

"Update a deployment branch policy"에 대한 매개 변수

머리글
이름, Type, 설명
accept string

Setting to application/vnd.github+json is recommended.

경로 매개 변수
이름, Type, 설명
owner string Required

The account owner of the repository. The name is not case sensitive.

repo string Required

The name of the repository without the .git extension. The name is not case sensitive.

environment_name string Required

The name of the environment. The name must be URL encoded. For example, any slashes in the name must be replaced with %2F.

branch_policy_id integer Required

The unique identifier of the branch policy.

본문 매개 변수
이름, Type, 설명
name string Required

The name pattern that branches must match in order to deploy to the environment.

Wildcard characters will not match /. For example, to match branches that begin with release/ and contain an additional single slash, use release/*/*. For more information about pattern matching syntax, see the Ruby File.fnmatch documentation.

"Update a deployment branch policy"에 대한 HTTP 응답 상태 코드

상태 코드설명
200

OK

"Update a deployment branch policy"에 대한 코드 샘플

put/repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id}
curl -L \ -X PUT \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ https://HOSTNAME/api/v3/repos/OWNER/REPO/environments/ENVIRONMENT_NAME/deployment-branch-policies/BRANCH_POLICY_ID \ -d '{"name":"release/*"}'

Response

Status: 200
{ "id": 364662, "node_id": "MDE2OkdhdGVCcmFuY2hQb2xpY3kzNjQ2NjI=", "name": "release/*" }

Delete a deployment branch policy

Works with GitHub Apps

Deletes a deployment branch or tag policy for an environment.

You must authenticate using an access token with the repo scope to use this endpoint. GitHub Apps must have the administration:write permission for the repository to use this endpoint.

"Delete a deployment branch policy"에 대한 매개 변수

머리글
이름, Type, 설명
accept string

Setting to application/vnd.github+json is recommended.

경로 매개 변수
이름, Type, 설명
owner string Required

The account owner of the repository. The name is not case sensitive.

repo string Required

The name of the repository without the .git extension. The name is not case sensitive.

environment_name string Required

The name of the environment. The name must be URL encoded. For example, any slashes in the name must be replaced with %2F.

branch_policy_id integer Required

The unique identifier of the branch policy.

"Delete a deployment branch policy"에 대한 HTTP 응답 상태 코드

상태 코드설명
204

No Content

"Delete a deployment branch policy"에 대한 코드 샘플

delete/repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id}
curl -L \ -X DELETE \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ https://HOSTNAME/api/v3/repos/OWNER/REPO/environments/ENVIRONMENT_NAME/deployment-branch-policies/BRANCH_POLICY_ID

Response

Status: 204