import requests
url = "https://platform.ankra.app/api/v1/org/applications/{application_id}/security-fixes/{run_id}/merge"
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/applications/{application_id}/security-fixes/{run_id}/merge', 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/applications/{application_id}/security-fixes/{run_id}/merge \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"head_sha": "<string>"
}
'{
"attempts": 123,
"checks": {
"pipeline_run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"state": "running",
"url": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"findings": [
{
"from": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"package": "<string>",
"severity": "<string>",
"to": "<string>",
"vulnerability_id": "<string>"
}
],
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"kind": "image_rebuild",
"max_attempts": 123,
"merge": {
"approved_at": "2023-11-07T05:31:56Z",
"approved_by": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"approved_head_sha": "<string>",
"can_approve": true,
"merge_commit_sha": "<string>",
"merged_at": "2023-11-07T05:31:56Z",
"merged_by": "ankra",
"mode": "wait_for_you",
"state": "not_ready",
"reason": "<string>"
},
"pull_request": {
"branch": "<string>",
"head_sha": "<string>",
"number": 123,
"repository": "<string>",
"url": "<string>"
},
"review": {
"findings_addressed": 123,
"findings_open": 123,
"state": "none"
},
"started_by": {
"actor": "person",
"trigger": "<string>",
"user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"status": "working",
"status_reason": "<string>",
"title": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}Approve a security fix merge
Approves the merge of one security fix pull request at the head the person reviewed. Ankra merges it at once when its checks and review are green (squash, or through the repository’s merge train when it has one), and otherwise refuses with the reason; a push to the branch clears an approval. The person’s approval is the authority for the merge, so a paused organisation or application does not hold it. Requires security.manage and the merge authority (an organisation administrator, the pull request’s author, or a member whose verified GitHub login can push to the repository); a service account token is refused.
import requests
url = "https://platform.ankra.app/api/v1/org/applications/{application_id}/security-fixes/{run_id}/merge"
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/applications/{application_id}/security-fixes/{run_id}/merge', 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/applications/{application_id}/security-fixes/{run_id}/merge \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"head_sha": "<string>"
}
'{
"attempts": 123,
"checks": {
"pipeline_run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"state": "running",
"url": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"findings": [
{
"from": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"package": "<string>",
"severity": "<string>",
"to": "<string>",
"vulnerability_id": "<string>"
}
],
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"kind": "image_rebuild",
"max_attempts": 123,
"merge": {
"approved_at": "2023-11-07T05:31:56Z",
"approved_by": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"approved_head_sha": "<string>",
"can_approve": true,
"merge_commit_sha": "<string>",
"merged_at": "2023-11-07T05:31:56Z",
"merged_by": "ankra",
"mode": "wait_for_you",
"state": "not_ready",
"reason": "<string>"
},
"pull_request": {
"branch": "<string>",
"head_sha": "<string>",
"number": 123,
"repository": "<string>",
"url": "<string>"
},
"review": {
"findings_addressed": 123,
"findings_open": 123,
"state": "none"
},
"started_by": {
"actor": "person",
"trigger": "<string>",
"user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"status": "working",
"status_reason": "<string>",
"title": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}Authorizations
Response
The fix as it now stands: merged, or merging when the merge train holds it
One security fix pull request of the application and the remediation run that follows it. review is Ankra's AI review of the head shown: state is its verdict, pending while the repository's review lane is on and that head has no review yet, and none where the lane is off; findings_open counts the findings that review left, and findings_addressed the review findings Ankra's fix commits have answered on the pull request; merge.mode is when_green only when the application's keep_it_safe choice is a stored Ankra runs it in every environment it runs in; merge.state and merge.reason are the merge lane's last decision, and can_approve is true only for a caller holding security.manage and the merge authority while the fix is green and waiting for a person.