feat: Add Actions API rerun endpoints for runs and jobs (#36768)

This PR adds official REST API endpoints to rerun Gitea Actions workflow
runs and individual jobs:

* POST /api/v1/repos/{owner}/{repo}/actions/runs/{run}/rerun
* POST /api/v1/repos/{owner}/{repo}/actions/runs/{run}/jobs/{job_id}/rerun

It reuses the existing rerun behavior from the web UI and exposes it
through stable API routes.

---------

Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
This commit is contained in:
Nicolas
2026-03-02 22:34:06 +01:00
committed by GitHub
parent 56f23f623a
commit 054eb6d8a5
9 changed files with 580 additions and 183 deletions

View File

@@ -5297,6 +5297,117 @@
}
}
},
"/repos/{owner}/{repo}/actions/runs/{run}/jobs/{job_id}/rerun": {
"post": {
"produces": [
"application/json"
],
"tags": [
"repository"
],
"summary": "Reruns a specific workflow job in a run",
"operationId": "rerunWorkflowJob",
"parameters": [
{
"type": "string",
"description": "owner of the repo",
"name": "owner",
"in": "path",
"required": true
},
{
"type": "string",
"description": "name of the repository",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "id of the run",
"name": "run",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "id of the job",
"name": "job_id",
"in": "path",
"required": true
}
],
"responses": {
"201": {
"$ref": "#/responses/WorkflowJob"
},
"400": {
"$ref": "#/responses/error"
},
"403": {
"$ref": "#/responses/forbidden"
},
"404": {
"$ref": "#/responses/notFound"
},
"422": {
"$ref": "#/responses/validationError"
}
}
}
},
"/repos/{owner}/{repo}/actions/runs/{run}/rerun": {
"post": {
"produces": [
"application/json"
],
"tags": [
"repository"
],
"summary": "Reruns an entire workflow run",
"operationId": "rerunWorkflowRun",
"parameters": [
{
"type": "string",
"description": "owner of the repo",
"name": "owner",
"in": "path",
"required": true
},
{
"type": "string",
"description": "name of the repository",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "id of the run",
"name": "run",
"in": "path",
"required": true
}
],
"responses": {
"201": {
"$ref": "#/responses/WorkflowRun"
},
"400": {
"$ref": "#/responses/error"
},
"403": {
"$ref": "#/responses/forbidden"
},
"404": {
"$ref": "#/responses/notFound"
},
"422": {
"$ref": "#/responses/validationError"
}
}
}
},
"/repos/{owner}/{repo}/actions/secrets": {
"get": {
"produces": [