markdown · 1146 bytes Raw Blame History

Actions workflow API

Actions workflow lifecycle endpoints are PAT-authenticated and require repo:write. The token's user must also have write permission on the repository that owns the target run or job.

Cancel job

POST /api/v1/jobs/{id}/cancel

Requests cancellation for a workflow job. Queued jobs become terminal immediately. Running jobs set cancel_requested=true; the runner observes that flag through its cancel-check endpoint, stops the active container, and reports the terminal status.

Response: 202 Accepted.

{
  "job_id": 10,
  "run_id": 4,
  "repo_id": 2,
  "changed_jobs": 1,
  "run_completed": false,
  "run_conclusion": ""
}

Re-run workflow run

POST /api/v1/runs/{id}/rerun

Creates a new workflow run from the original run's commit and workflow file. Only terminal runs are rerunnable. The new run records parent_run_id so the history remains linked.

Response: 201 Created.

{
  "run_id": 12,
  "run_index": 8,
  "parent_run_id": 4,
  "repo_id": 2,
  "workflow_file": ".shithub/workflows/ci.yml",
  "head_sha": "0123456789abcdef0123456789abcdef01234567"
}
View source
1 # Actions workflow API
2
3 Actions workflow lifecycle endpoints are PAT-authenticated and require
4 `repo:write`. The token's user must also have write permission on the
5 repository that owns the target run or job.
6
7 ## Cancel job
8
9 ```text
10 POST /api/v1/jobs/{id}/cancel
11 ```
12
13 Requests cancellation for a workflow job. Queued jobs become terminal
14 immediately. Running jobs set `cancel_requested=true`; the runner observes
15 that flag through its cancel-check endpoint, stops the active container, and
16 reports the terminal status.
17
18 Response: `202 Accepted`.
19
20 ```json
21 {
22 "job_id": 10,
23 "run_id": 4,
24 "repo_id": 2,
25 "changed_jobs": 1,
26 "run_completed": false,
27 "run_conclusion": ""
28 }
29 ```
30
31 ## Re-run workflow run
32
33 ```text
34 POST /api/v1/runs/{id}/rerun
35 ```
36
37 Creates a new workflow run from the original run's commit and workflow file.
38 Only terminal runs are rerunnable. The new run records `parent_run_id` so the
39 history remains linked.
40
41 Response: `201 Created`.
42
43 ```json
44 {
45 "run_id": 12,
46 "run_index": 8,
47 "parent_run_id": 4,
48 "repo_id": 2,
49 "workflow_file": ".shithub/workflows/ci.yml",
50 "head_sha": "0123456789abcdef0123456789abcdef01234567"
51 }
52 ```