tenseleyflow/shithub / 6a1a493

Browse files

docs/api: actions lifecycle reference

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
6a1a493106834627037d733bb50d2b92def78379
Parents
670c2e9
Tree
e8200a1

2 changed files

StatusFile+-
M docs/public/SUMMARY.md 1 0
A docs/public/api/actions-lifecycle.md 110 0
docs/public/SUMMARY.mdmodified
@@ -39,6 +39,7 @@
3939
 - [Status checks](./api/checks.md)
4040
 - [Actions workflow API](./api/actions.md)
4141
 - [Actions workflows (list/dispatch)](./api/actions-workflows.md)
42
+- [Actions lifecycle (enable/disable + run delete + artifacts + job logs)](./api/actions-lifecycle.md)
4243
 - [Actions workflow runs](./api/actions-runs.md)
4344
 - [Actions runner API](./api/actions-runner.md)
4445
 - [Webhooks](./api/webhooks.md)
docs/public/api/actions-lifecycle.mdadded
@@ -0,0 +1,110 @@
1
+# Actions lifecycle
2
+
3
+State-changing endpoints for workflows, runs, and artifacts. The
4
+cancel + rerun routes from the S41g actions-lifecycle surface
5
+are documented separately in
6
+[Actions workflow API](./actions.md); this page covers the
7
+S50 §13 REST additions.
8
+
9
+Scopes:
10
+
11
+- `repo:read` on the artifact reads + job-log download
12
+- `repo:write` on enable/disable, run delete, artifact delete
13
+
14
+## Endpoints
15
+
16
+```
17
+PUT    /api/v1/repos/{o}/{r}/actions/workflows/{file}/enable
18
+PUT    /api/v1/repos/{o}/{r}/actions/workflows/{file}/disable
19
+DELETE /api/v1/repos/{o}/{r}/actions/runs/{run_id}
20
+GET    /api/v1/repos/{o}/{r}/actions/runs/{run_id}/artifacts
21
+GET    /api/v1/repos/{o}/{r}/actions/artifacts/{artifact_id}
22
+GET    /api/v1/repos/{o}/{r}/actions/artifacts/{artifact_id}/zip
23
+DELETE /api/v1/repos/{o}/{r}/actions/artifacts/{artifact_id}
24
+GET    /api/v1/repos/{o}/{r}/actions/jobs/{job_id}/logs
25
+```
26
+
27
+## Enable / disable a workflow
28
+
29
+```
30
+PUT /api/v1/repos/alice/demo/actions/workflows/ci.yml/disable
31
+```
32
+
33
+Idempotent. Returns `204 No Content`. While a workflow is
34
+disabled, matching events (push, PR, dispatch, schedule) do not
35
+enqueue runs — the trigger pipeline consults the
36
+`workflow_disabled` row and short-circuits with `Skipped: true`.
37
+Re-enabling with PUT `/enable` removes the row and resumes
38
+triggering on the next event.
39
+
40
+The workflows list endpoint reports disabled workflows with
41
+`"state": "disabled"`.
42
+
43
+## Delete a workflow run
44
+
45
+```
46
+DELETE /api/v1/repos/alice/demo/actions/runs/42
47
+```
48
+
49
+Returns `204 No Content`. Cascades to all dependent rows
50
+(`workflow_jobs`, `workflow_steps`, `workflow_step_log_chunks`,
51
+`workflow_artifacts`). Artifact blobs in object storage are
52
+best-effort cleaned up asynchronously after the row is gone; the
53
+cleanup sweeper picks up any orphans left behind.
54
+
55
+Returns `404` if the run id is unknown OR if the run belongs to a
56
+different repo (existence-leak-safe).
57
+
58
+## Artifacts
59
+
60
+```
61
+GET /api/v1/repos/alice/demo/actions/runs/42/artifacts
62
+```
63
+
64
+```json
65
+[
66
+  {
67
+    "id":          17,
68
+    "name":        "logs",
69
+    "size_bytes":  4096,
70
+    "archive_url": "https://shithub.example/api/v1/repos/alice/demo/actions/artifacts/17/zip",
71
+    "expires_at":  "2026-06-12T18:00:00Z",
72
+    "created_at":  "2026-05-12T18:00:00Z"
73
+  }
74
+]
75
+```
76
+
77
+`archive_url` points at the download endpoint:
78
+
79
+```
80
+GET /api/v1/repos/alice/demo/actions/artifacts/17/zip
81
+```
82
+
83
+Streams the artifact bytes directly from the object store with
84
+`Content-Type: application/zip` and a sensible
85
+`Content-Disposition`. No redirect — the bytes come back inline.
86
+
87
+`DELETE /api/v1/repos/alice/demo/actions/artifacts/17` removes the
88
+DB row + queues the blob for async cleanup. `204` on success;
89
+`404` when the artifact id is unknown or belongs to a different
90
+repo.
91
+
92
+## Job logs
93
+
94
+```
95
+GET /api/v1/repos/alice/demo/actions/jobs/119/logs
96
+```
97
+
98
+Returns `text/plain` with the assembled log transcript across all
99
+steps in the job. Each step is wrapped in `##[group]` /
100
+`##[endgroup]` markers so the output remains readable when piped
101
+or `less`'d. Order matches the step execution order.
102
+
103
+## Errors
104
+
105
+| Status | Cause                                                       |
106
+|------:|--------------------------------------------------------------|
107
+| 400   | Workflow file path malformed (enable/disable).               |
108
+| 403   | PAT lacks the required scope.                                 |
109
+| 404   | Repo / run / artifact / job unknown, or owned by a different repo. |
110
+| 503   | Object store unavailable (artifact download path).           |