import requests
url = "https://platform.ankra.app/api/v1/org/pipeline-repositories/{repository_id}/merge-train/settings"
payload = { "enabled": True }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({enabled: true})
};
fetch('https://platform.ankra.app/api/v1/org/pipeline-repositories/{repository_id}/merge-train/settings', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PUT \
--url https://platform.ankra.app/api/v1/org/pipeline-repositories/{repository_id}/merge-train/settings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"enabled": true
}
'{
"enabled": true,
"max_cars": 4,
"auto_admit": "off",
"auto_admit_by": "<string>",
"auto_admit_since": "2023-11-07T05:31:56Z",
"auto_admit_criterion": "green",
"auto_admit_protected_paths": [
"<string>"
],
"auto_admit_protected_paths_is_default": true
}Set a repository's merge train settings
Switches the repository’s merge train on or off, sets how many pull requests it tests at once, puts auto-admit in off, shadow or on, and sets the criterion it admits by (green, ready_shadow or ready) and the paths that keep green under ready. Switching the train off empties it: every pull request in it leaves, and its car’s run stops. GitHub repositories only. Requires pipelines.manage; switching auto-admit on, its criterion to ready, or its protected paths also needs a human member, not a service account token.
import requests
url = "https://platform.ankra.app/api/v1/org/pipeline-repositories/{repository_id}/merge-train/settings"
payload = { "enabled": True }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({enabled: true})
};
fetch('https://platform.ankra.app/api/v1/org/pipeline-repositories/{repository_id}/merge-train/settings', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PUT \
--url https://platform.ankra.app/api/v1/org/pipeline-repositories/{repository_id}/merge-train/settings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"enabled": true
}
'{
"enabled": true,
"max_cars": 4,
"auto_admit": "off",
"auto_admit_by": "<string>",
"auto_admit_since": "2023-11-07T05:31:56Z",
"auto_admit_criterion": "green",
"auto_admit_protected_paths": [
"<string>"
],
"auto_admit_protected_paths_is_default": true
}Authorizations
Body
Puts auto-admit in a mode; omitted keeps the current one. Switching it on makes the caller the member every pull request it admits is requested by, and is refused for a service account token. Asking for the mode it is already in keeps the member who put it there.
off, shadow, on Sets the path patterns that keep the green criterion under ready; omitted keeps the current list, null restores the default list, and an empty list protects nothing. Changing the list is refused for a service account token.
501 - 256Response
The stored settings.
Whether the merge train puts green pull requests in itself. While the train is on, an open, non-draft pull request from the repository itself, into the default branch, whose newest pull request run passed at its current head in the last 24 hours, opened by an organisation member or a writer, with no changes requested, no approval missing and no unresolved review thread, without the ankra:hold label, whose declared dependencies (Depends-on:) are merged with every check on their merge commit passed, and whose description names no open pull request of another repository it did not declare, enters the train - unless it already left the train at that head for a reason that would recur. shadow decides the same and records it in auto_admit_decisions without enqueueing anything. off by default.
off, shadow, on What auto-admit waits for before it puts a pull request in the train. green (the default): its newest pull request run passed, as described under auto_admit. ready: its newest pull request run at its current head has not failed - still running with no failed step, or passed at any age - and the host reports it merges cleanly; every other auto_admit rule still applies, a pull request touching one of auto_admit_protected_paths still waits for its run to pass, and an entry admitted at ready whose own run fails before its car passed is taken out of the train with reason pull_request_run_red. ready_shadow admits green and records in auto_admit_decisions what ready would have admitted (ready_shadow_admit). Enable ready only after cars run wave 3: until the repository's merge train cars run every check its pull request runs do, admitting at ready merges on a car that skipped them.
green, ready_shadow, ready