curl --request PUT \
--url https://api.trunk.io/v2beta/dynamic-ci/force-overrides \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"repo": {
"owner": "acme",
"name": "widgets",
"host": "github.com"
},
"prNumber": 4213,
"headSha": "9f2c1b7c2b4c9d1e0a3f5b6c7d8e9f0a1b2c3d4e",
"overrides": [
{
"scope": "job",
"workflowId": "2b3c4d5e-0000-4000-8000-000000000002",
"jobId": "3c4d5e6f-0000-4000-8000-000000000003"
}
]
}
'import requests
url = "https://api.trunk.io/v2beta/dynamic-ci/force-overrides"
payload = {
"repo": {
"owner": "acme",
"name": "widgets",
"host": "github.com"
},
"prNumber": 4213,
"headSha": "9f2c1b7c2b4c9d1e0a3f5b6c7d8e9f0a1b2c3d4e",
"overrides": [
{
"scope": "job",
"workflowId": "2b3c4d5e-0000-4000-8000-000000000002",
"jobId": "3c4d5e6f-0000-4000-8000-000000000003"
}
]
}
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({
repo: {owner: 'acme', name: 'widgets', host: 'github.com'},
prNumber: 4213,
headSha: '9f2c1b7c2b4c9d1e0a3f5b6c7d8e9f0a1b2c3d4e',
overrides: [
{
scope: 'job',
workflowId: '2b3c4d5e-0000-4000-8000-000000000002',
jobId: '3c4d5e6f-0000-4000-8000-000000000003'
}
]
})
};
fetch('https://api.trunk.io/v2beta/dynamic-ci/force-overrides', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.trunk.io/v2beta/dynamic-ci/force-overrides",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'repo' => [
'owner' => 'acme',
'name' => 'widgets',
'host' => 'github.com'
],
'prNumber' => 4213,
'headSha' => '9f2c1b7c2b4c9d1e0a3f5b6c7d8e9f0a1b2c3d4e',
'overrides' => [
[
'scope' => 'job',
'workflowId' => '2b3c4d5e-0000-4000-8000-000000000002',
'jobId' => '3c4d5e6f-0000-4000-8000-000000000003'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.trunk.io/v2beta/dynamic-ci/force-overrides"
payload := strings.NewReader("{\n \"repo\": {\n \"owner\": \"acme\",\n \"name\": \"widgets\",\n \"host\": \"github.com\"\n },\n \"prNumber\": 4213,\n \"headSha\": \"9f2c1b7c2b4c9d1e0a3f5b6c7d8e9f0a1b2c3d4e\",\n \"overrides\": [\n {\n \"scope\": \"job\",\n \"workflowId\": \"2b3c4d5e-0000-4000-8000-000000000002\",\n \"jobId\": \"3c4d5e6f-0000-4000-8000-000000000003\"\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.trunk.io/v2beta/dynamic-ci/force-overrides")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"repo\": {\n \"owner\": \"acme\",\n \"name\": \"widgets\",\n \"host\": \"github.com\"\n },\n \"prNumber\": 4213,\n \"headSha\": \"9f2c1b7c2b4c9d1e0a3f5b6c7d8e9f0a1b2c3d4e\",\n \"overrides\": [\n {\n \"scope\": \"job\",\n \"workflowId\": \"2b3c4d5e-0000-4000-8000-000000000002\",\n \"jobId\": \"3c4d5e6f-0000-4000-8000-000000000003\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trunk.io/v2beta/dynamic-ci/force-overrides")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"repo\": {\n \"owner\": \"acme\",\n \"name\": \"widgets\",\n \"host\": \"github.com\"\n },\n \"prNumber\": 4213,\n \"headSha\": \"9f2c1b7c2b4c9d1e0a3f5b6c7d8e9f0a1b2c3d4e\",\n \"overrides\": [\n {\n \"scope\": \"job\",\n \"workflowId\": \"2b3c4d5e-0000-4000-8000-000000000002\",\n \"jobId\": \"3c4d5e6f-0000-4000-8000-000000000003\"\n }\n ]\n}"
response = http.request(request)
puts response.read_bodyReplace a pull request's force overrides
Requires the Force CI jobs to run permission.
Sets the complete list of forces active on a pull request. This replaces the set, it does not add to it — a force you omit is revoked, and an empty list clears them all. Send the desired end state, not a delta.
Scopes are addressed by the workflowId and jobId that dynamicCi.listPrJobs returns. An already-active force is left alone, so re-sending an unchanged list changes nothing. Forces are applied the next time dynamicCi.generatePlan runs for this pull request; this does not re-run anything itself.
curl --request PUT \
--url https://api.trunk.io/v2beta/dynamic-ci/force-overrides \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"repo": {
"owner": "acme",
"name": "widgets",
"host": "github.com"
},
"prNumber": 4213,
"headSha": "9f2c1b7c2b4c9d1e0a3f5b6c7d8e9f0a1b2c3d4e",
"overrides": [
{
"scope": "job",
"workflowId": "2b3c4d5e-0000-4000-8000-000000000002",
"jobId": "3c4d5e6f-0000-4000-8000-000000000003"
}
]
}
'import requests
url = "https://api.trunk.io/v2beta/dynamic-ci/force-overrides"
payload = {
"repo": {
"owner": "acme",
"name": "widgets",
"host": "github.com"
},
"prNumber": 4213,
"headSha": "9f2c1b7c2b4c9d1e0a3f5b6c7d8e9f0a1b2c3d4e",
"overrides": [
{
"scope": "job",
"workflowId": "2b3c4d5e-0000-4000-8000-000000000002",
"jobId": "3c4d5e6f-0000-4000-8000-000000000003"
}
]
}
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({
repo: {owner: 'acme', name: 'widgets', host: 'github.com'},
prNumber: 4213,
headSha: '9f2c1b7c2b4c9d1e0a3f5b6c7d8e9f0a1b2c3d4e',
overrides: [
{
scope: 'job',
workflowId: '2b3c4d5e-0000-4000-8000-000000000002',
jobId: '3c4d5e6f-0000-4000-8000-000000000003'
}
]
})
};
fetch('https://api.trunk.io/v2beta/dynamic-ci/force-overrides', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.trunk.io/v2beta/dynamic-ci/force-overrides",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'repo' => [
'owner' => 'acme',
'name' => 'widgets',
'host' => 'github.com'
],
'prNumber' => 4213,
'headSha' => '9f2c1b7c2b4c9d1e0a3f5b6c7d8e9f0a1b2c3d4e',
'overrides' => [
[
'scope' => 'job',
'workflowId' => '2b3c4d5e-0000-4000-8000-000000000002',
'jobId' => '3c4d5e6f-0000-4000-8000-000000000003'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.trunk.io/v2beta/dynamic-ci/force-overrides"
payload := strings.NewReader("{\n \"repo\": {\n \"owner\": \"acme\",\n \"name\": \"widgets\",\n \"host\": \"github.com\"\n },\n \"prNumber\": 4213,\n \"headSha\": \"9f2c1b7c2b4c9d1e0a3f5b6c7d8e9f0a1b2c3d4e\",\n \"overrides\": [\n {\n \"scope\": \"job\",\n \"workflowId\": \"2b3c4d5e-0000-4000-8000-000000000002\",\n \"jobId\": \"3c4d5e6f-0000-4000-8000-000000000003\"\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.trunk.io/v2beta/dynamic-ci/force-overrides")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"repo\": {\n \"owner\": \"acme\",\n \"name\": \"widgets\",\n \"host\": \"github.com\"\n },\n \"prNumber\": 4213,\n \"headSha\": \"9f2c1b7c2b4c9d1e0a3f5b6c7d8e9f0a1b2c3d4e\",\n \"overrides\": [\n {\n \"scope\": \"job\",\n \"workflowId\": \"2b3c4d5e-0000-4000-8000-000000000002\",\n \"jobId\": \"3c4d5e6f-0000-4000-8000-000000000003\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trunk.io/v2beta/dynamic-ci/force-overrides")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"repo\": {\n \"owner\": \"acme\",\n \"name\": \"widgets\",\n \"host\": \"github.com\"\n },\n \"prNumber\": 4213,\n \"headSha\": \"9f2c1b7c2b4c9d1e0a3f5b6c7d8e9f0a1b2c3d4e\",\n \"overrides\": [\n {\n \"scope\": \"job\",\n \"workflowId\": \"2b3c4d5e-0000-4000-8000-000000000002\",\n \"jobId\": \"3c4d5e6f-0000-4000-8000-000000000003\"\n }\n ]\n}"
response = http.request(request)
puts response.read_bodyAuthorizations
An API key, sent as Authorization: Bearer <key>. An organization admin creates one in the Trunk app under Settings → Developer → API Keys and chooses the permissions it holds. A key with none can read merge queues but change nothing in them. Permissions cover merge queues and test-result uploads, including the quarantine lookups a CI run makes before it uploads; any key can call the other Flaky Tests and Dynamic CI endpoints, including their writes.
Body
Response
The forces were replaced
Was this page helpful?