배포 분기 정책에 대한 REST API 엔드포인트
REST API를 사용하여 사용자 지정 배포 분기 정책을 관리합니다.
배포 분기 정책 정보
REST API를 사용하면 환경에 배포하기 위해 분기가 일치해야 하는 사용자 지정 이름 패턴을 지정할 수 있습니다. 이러한 엔드포인트를 사용하려면 환경의 deployment_branch_policy.custom_branch_policies 속성이 true로 설정되어야 합니다. 환경에 대한 deployment_branch_policy를 업데이트하려면 배포 환경을 위한 REST API 엔드포인트을(를) 참조하세요.
환경 배포를 특정 분기로 제한하는 방법에 대한 자세한 정보는 배포 환경 관리을(를) 참조하세요.
List deployment branch policies
Lists the deployment branch policies for an environment.
Anyone with read access to the repository can use this endpoint.
OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint with a private repository.
fine_grained_access
works_with_fine_grained_tokens:
permission_set:
- "Actions" repository permissions (read)
allows_public_read_access
"List deployment branch policies"에 대한 매개 변수
| 이름, 유형, 설명 |
|---|
accept string Setting to |
| 이름, 유형, 설명 |
|---|
owner string 필수The account owner of the repository. The name is not case sensitive. |
repo string 필수The name of the repository without the |
environment_name string 필수The name of the environment. The name must be URL encoded. For example, any slashes in the name must be replaced with |
| 이름, 유형, 설명 |
|---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." 기본값: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." 기본값: |
http_status_code
| status_code | 설명 |
|---|---|
200 | OK |
code_samples
data_residency_notice
request_example
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://api.github.com/repos/OWNER/REPO/environments/ENVIRONMENT_NAME/deployment-branch-policiesResponse
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
Creates a deployment branch or tag policy for an environment.
OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint.
fine_grained_access
works_with_fine_grained_tokens:
permission_set:
- "Administration" repository permissions (write)
"Create a deployment branch policy"에 대한 매개 변수
| 이름, 유형, 설명 |
|---|
accept string Setting to |
| 이름, 유형, 설명 |
|---|
owner string 필수The account owner of the repository. The name is not case sensitive. |
repo string 필수The name of the repository without the |
environment_name string 필수The name of the environment. The name must be URL encoded. For example, any slashes in the name must be replaced with |
| 이름, 유형, 설명 |
|---|
name string 필수The name pattern that branches or tags must match in order to deploy to the environment. Wildcard characters will not match |
type string Whether this rule targets a branch or tag 다음 중 하나일 수 있습니다.: |
http_status_code
| status_code | 설명 |
|---|---|
200 | OK |
303 | Response if the same branch name pattern already exists |
404 | Not Found or |
code_samples
data_residency_notice
request_examples
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://api.github.com/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
Gets a deployment branch or tag policy for an environment.
Anyone with read access to the repository can use this endpoint.
OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint with a private repository.
fine_grained_access
works_with_fine_grained_tokens:
permission_set:
- "Actions" repository permissions (read)
allows_public_read_access
"Get a deployment branch policy"에 대한 매개 변수
| 이름, 유형, 설명 |
|---|
accept string Setting to |
| 이름, 유형, 설명 |
|---|
owner string 필수The account owner of the repository. The name is not case sensitive. |
repo string 필수The name of the repository without the |
environment_name string 필수The name of the environment. The name must be URL encoded. For example, any slashes in the name must be replaced with |
branch_policy_id integer 필수The unique identifier of the branch policy. |
http_status_code
| status_code | 설명 |
|---|---|
200 | OK |
code_samples
data_residency_notice
request_example
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://api.github.com/repos/OWNER/REPO/environments/ENVIRONMENT_NAME/deployment-branch-policies/BRANCH_POLICY_IDResponse
Status: 200{
"id": 364662,
"node_id": "MDE2OkdhdGVCcmFuY2hQb2xpY3kzNjQ2NjI=",
"name": "release/*"
}Update a deployment branch policy
Updates a deployment branch or tag policy for an environment.
OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint.
fine_grained_access
works_with_fine_grained_tokens:
permission_set:
- "Administration" repository permissions (write)
"Update a deployment branch policy"에 대한 매개 변수
| 이름, 유형, 설명 |
|---|
accept string Setting to |
| 이름, 유형, 설명 |
|---|
owner string 필수The account owner of the repository. The name is not case sensitive. |
repo string 필수The name of the repository without the |
environment_name string 필수The name of the environment. The name must be URL encoded. For example, any slashes in the name must be replaced with |
branch_policy_id integer 필수The unique identifier of the branch policy. |
| 이름, 유형, 설명 |
|---|
name string 필수The name pattern that branches must match in order to deploy to the environment. Wildcard characters will not match |
http_status_code
| status_code | 설명 |
|---|---|
200 | OK |
code_samples
data_residency_notice
request_example
curl -L \
-X PUT \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://api.github.com/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
Deletes a deployment branch or tag policy for an environment.
OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint.
fine_grained_access
works_with_fine_grained_tokens:
permission_set:
- "Administration" repository permissions (write)
"Delete a deployment branch policy"에 대한 매개 변수
| 이름, 유형, 설명 |
|---|
accept string Setting to |
| 이름, 유형, 설명 |
|---|
owner string 필수The account owner of the repository. The name is not case sensitive. |
repo string 필수The name of the repository without the |
environment_name string 필수The name of the environment. The name must be URL encoded. For example, any slashes in the name must be replaced with |
branch_policy_id integer 필수The unique identifier of the branch policy. |
http_status_code
| status_code | 설명 |
|---|---|
204 | No Content |
code_samples
data_residency_notice
request_example
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://api.github.com/repos/OWNER/REPO/environments/ENVIRONMENT_NAME/deployment-branch-policies/BRANCH_POLICY_IDResponse
Status: 204