import requests
url = "https://platform.ankra.app/api/v1/org/applications/{application_id}/merge-train/entries"
payload = { "pull_request_number": 2 }
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({pull_request_number: 2})
};
fetch('https://platform.ankra.app/api/v1/org/applications/{application_id}/merge-train/entries', 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}/merge-train/entries \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"pull_request_number": 2
}
'{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"pull_request_number": 123,
"pull_request_head_sha": "<string>",
"pull_request_title": "<string>",
"base_branch": "<string>",
"status": "queued",
"position": 123,
"attempt": 123,
"requested_by": "<string>",
"requested_via": "api",
"enqueued_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"pull_request_head_branch": "<string>",
"parent_entry_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"parent_pull_request_number": 123,
"car_branch": "<string>",
"car_base_sha": "<string>",
"car_commit_sha": "<string>",
"car_tree_sha": "<string>",
"predecessor_entry_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"pipeline_run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tested_by_entry_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tested_by_pull_request_number": 123,
"tested_by_run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"merge_commit_sha": "<string>",
"merge_tree_matches": true,
"reason": "<string>",
"reason_text": "<string>",
"detail": "<string>",
"started_at": "2023-11-07T05:31:56Z",
"finished_at": "2023-11-07T05:31:56Z"
}{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"pull_request_number": 123,
"pull_request_head_sha": "<string>",
"pull_request_title": "<string>",
"base_branch": "<string>",
"status": "queued",
"position": 123,
"attempt": 123,
"requested_by": "<string>",
"requested_via": "api",
"enqueued_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"pull_request_head_branch": "<string>",
"parent_entry_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"parent_pull_request_number": 123,
"car_branch": "<string>",
"car_base_sha": "<string>",
"car_commit_sha": "<string>",
"car_tree_sha": "<string>",
"predecessor_entry_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"pipeline_run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tested_by_entry_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tested_by_pull_request_number": 123,
"tested_by_run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"merge_commit_sha": "<string>",
"merge_tree_matches": true,
"reason": "<string>",
"reason_text": "<string>",
"detail": "<string>",
"started_at": "2023-11-07T05:31:56Z",
"finished_at": "2023-11-07T05:31:56Z"
}Add a pull request to an application's merge train
Puts a pull request at the end of the repository’s merge train. Ankra tests it squashed onto the base branch and the pull requests ahead of it, exactly as the merge will land, and merges it through the host’s own merge when that run passes. A pull request already in the train answers its entry with 200. A pull request based on the branch of another pull request in the train is stacked on it: tested on its car and merged after it, retargeted onto the base branch first; one based on a pull request that is not in the train is refused with 409. Addressed by application: the merge train of the pipeline repository the application is connected to. Must be called by a person, not a service account token. The caller must also be an organisation administrator, the pull request’s author, or a member with write access to the repository on GitHub, as GitHub reports it for the caller’s OAuth-verified GitHub identity. Requires pipelines.operate.
import requests
url = "https://platform.ankra.app/api/v1/org/applications/{application_id}/merge-train/entries"
payload = { "pull_request_number": 2 }
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({pull_request_number: 2})
};
fetch('https://platform.ankra.app/api/v1/org/applications/{application_id}/merge-train/entries', 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}/merge-train/entries \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"pull_request_number": 2
}
'{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"pull_request_number": 123,
"pull_request_head_sha": "<string>",
"pull_request_title": "<string>",
"base_branch": "<string>",
"status": "queued",
"position": 123,
"attempt": 123,
"requested_by": "<string>",
"requested_via": "api",
"enqueued_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"pull_request_head_branch": "<string>",
"parent_entry_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"parent_pull_request_number": 123,
"car_branch": "<string>",
"car_base_sha": "<string>",
"car_commit_sha": "<string>",
"car_tree_sha": "<string>",
"predecessor_entry_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"pipeline_run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tested_by_entry_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tested_by_pull_request_number": 123,
"tested_by_run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"merge_commit_sha": "<string>",
"merge_tree_matches": true,
"reason": "<string>",
"reason_text": "<string>",
"detail": "<string>",
"started_at": "2023-11-07T05:31:56Z",
"finished_at": "2023-11-07T05:31:56Z"
}{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"pull_request_number": 123,
"pull_request_head_sha": "<string>",
"pull_request_title": "<string>",
"base_branch": "<string>",
"status": "queued",
"position": 123,
"attempt": 123,
"requested_by": "<string>",
"requested_via": "api",
"enqueued_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"pull_request_head_branch": "<string>",
"parent_entry_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"parent_pull_request_number": 123,
"car_branch": "<string>",
"car_base_sha": "<string>",
"car_commit_sha": "<string>",
"car_tree_sha": "<string>",
"predecessor_entry_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"pipeline_run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tested_by_entry_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tested_by_pull_request_number": 123,
"tested_by_run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"merge_commit_sha": "<string>",
"merge_tree_matches": true,
"reason": "<string>",
"reason_text": "<string>",
"detail": "<string>",
"started_at": "2023-11-07T05:31:56Z",
"finished_at": "2023-11-07T05:31:56Z"
}Authorizations
Body
Response
The pull request was already in the train.
The entry whose run tests this entry's car: this entry when it has a run of its own, the head of its batch for a car that rides in one. Null when the entry has no car, when its batch has no head yet, or when the head is not among the entries in this response; null does not mean the car is untested.