Merge a pull request when green
import requests
url = "https://platform.ankra.app/api/v1/org/scm/pull-requests/{provider}/{owner}/{repo}/{number}/automerge"
payload = { "head_sha": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({head_sha: '<string>'})
};
fetch('https://platform.ankra.app/api/v1/org/scm/pull-requests/{provider}/{owner}/{repo}/{number}/automerge', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://platform.ankra.app/api/v1/org/scm/pull-requests/{provider}/{owner}/{repo}/{number}/automerge \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"head_sha": "<string>"
}
'{
"id": "<string>",
"organisation_id": "<string>",
"provider": "<string>",
"repo_owner": "<string>",
"repo_name": "<string>",
"pull_request_number": 123,
"head_sha": "<string>",
"requested_by": "<string>",
"requested_via": "<string>",
"status": "<string>",
"refusal_reason": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"merge_commit_sha": "<string>",
"merged_at": "2023-11-07T05:31:56Z"
}Pipelines
Merge a pull request when green
Records a merge-when-green request for a pull request at head_sha; Ankra merges it once its checks pass. Requires pipelines.operate and a human member (not a service account) whose verified Git identity may merge in the repository.
POST
/
api
/
v1
/
org
/
scm
/
pull-requests
/
{provider}
/
{owner}
/
{repo}
/
{number}
/
automerge
Merge a pull request when green
import requests
url = "https://platform.ankra.app/api/v1/org/scm/pull-requests/{provider}/{owner}/{repo}/{number}/automerge"
payload = { "head_sha": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({head_sha: '<string>'})
};
fetch('https://platform.ankra.app/api/v1/org/scm/pull-requests/{provider}/{owner}/{repo}/{number}/automerge', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://platform.ankra.app/api/v1/org/scm/pull-requests/{provider}/{owner}/{repo}/{number}/automerge \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"head_sha": "<string>"
}
'{
"id": "<string>",
"organisation_id": "<string>",
"provider": "<string>",
"repo_owner": "<string>",
"repo_name": "<string>",
"pull_request_number": 123,
"head_sha": "<string>",
"requested_by": "<string>",
"requested_via": "<string>",
"status": "<string>",
"refusal_reason": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"merge_commit_sha": "<string>",
"merged_at": "2023-11-07T05:31:56Z"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Available options:
github, gitlab, bitbucket_cloud Repository owner or workspace.
Repository name.
Pull request number.
Required range:
x >= 1Body
application/json
The head commit the merge is for; a newer push voids the request.
Response
The request was accepted
A request to merge a pull request once its checks are green.
Present once merged.
Present once merged.