Feature: Support workflow event dispatch via API (#33545)

Fix: https://github.com/go-gitea/gitea/issues/31765 (Re-open #32059)

---------

Co-authored-by: Bence Santha <git@santha.eu>
Co-authored-by: Bence Sántha <7604637+bencurio@users.noreply.github.com>
Co-authored-by: Christopher Homberger <christopher.homberger@web.de>
This commit is contained in:
wxiaoguang 2025-02-11 03:05:42 +08:00 committed by GitHub
parent 085f273d19
commit 30993e9508
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 1748 additions and 148 deletions

View file

@ -4421,6 +4421,275 @@
}
}
},
"/repos/{owner}/{repo}/actions/workflows": {
"get": {
"produces": [
"application/json"
],
"tags": [
"repository"
],
"summary": "List repository workflows",
"operationId": "ActionsListRepositoryWorkflows",
"parameters": [
{
"type": "string",
"description": "owner of the repo",
"name": "owner",
"in": "path",
"required": true
},
{
"type": "string",
"description": "name of the repo",
"name": "repo",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"$ref": "#/responses/ActionWorkflowList"
},
"400": {
"$ref": "#/responses/error"
},
"403": {
"$ref": "#/responses/forbidden"
},
"404": {
"$ref": "#/responses/notFound"
},
"422": {
"$ref": "#/responses/validationError"
},
"500": {
"$ref": "#/responses/error"
}
}
}
},
"/repos/{owner}/{repo}/actions/workflows/{workflow_id}": {
"get": {
"produces": [
"application/json"
],
"tags": [
"repository"
],
"summary": "Get a workflow",
"operationId": "ActionsGetWorkflow",
"parameters": [
{
"type": "string",
"description": "owner of the repo",
"name": "owner",
"in": "path",
"required": true
},
{
"type": "string",
"description": "name of the repo",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "id of the workflow",
"name": "workflow_id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"$ref": "#/responses/ActionWorkflow"
},
"400": {
"$ref": "#/responses/error"
},
"403": {
"$ref": "#/responses/forbidden"
},
"404": {
"$ref": "#/responses/notFound"
},
"422": {
"$ref": "#/responses/validationError"
},
"500": {
"$ref": "#/responses/error"
}
}
}
},
"/repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable": {
"put": {
"produces": [
"application/json"
],
"tags": [
"repository"
],
"summary": "Disable a workflow",
"operationId": "ActionsDisableWorkflow",
"parameters": [
{
"type": "string",
"description": "owner of the repo",
"name": "owner",
"in": "path",
"required": true
},
{
"type": "string",
"description": "name of the repo",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "id of the workflow",
"name": "workflow_id",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "No Content"
},
"400": {
"$ref": "#/responses/error"
},
"403": {
"$ref": "#/responses/forbidden"
},
"404": {
"$ref": "#/responses/notFound"
},
"422": {
"$ref": "#/responses/validationError"
}
}
}
},
"/repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches": {
"post": {
"produces": [
"application/json"
],
"tags": [
"repository"
],
"summary": "Create a workflow dispatch event",
"operationId": "ActionsDispatchWorkflow",
"parameters": [
{
"type": "string",
"description": "owner of the repo",
"name": "owner",
"in": "path",
"required": true
},
{
"type": "string",
"description": "name of the repo",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "id of the workflow",
"name": "workflow_id",
"in": "path",
"required": true
},
{
"name": "body",
"in": "body",
"schema": {
"$ref": "#/definitions/CreateActionWorkflowDispatch"
}
}
],
"responses": {
"204": {
"description": "No Content"
},
"400": {
"$ref": "#/responses/error"
},
"403": {
"$ref": "#/responses/forbidden"
},
"404": {
"$ref": "#/responses/notFound"
},
"422": {
"$ref": "#/responses/validationError"
}
}
}
},
"/repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable": {
"put": {
"produces": [
"application/json"
],
"tags": [
"repository"
],
"summary": "Enable a workflow",
"operationId": "ActionsEnableWorkflow",
"parameters": [
{
"type": "string",
"description": "owner of the repo",
"name": "owner",
"in": "path",
"required": true
},
{
"type": "string",
"description": "name of the repo",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "id of the workflow",
"name": "workflow_id",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "No Content"
},
"400": {
"$ref": "#/responses/error"
},
"403": {
"$ref": "#/responses/forbidden"
},
"404": {
"$ref": "#/responses/notFound"
},
"409": {
"$ref": "#/responses/conflict"
},
"422": {
"$ref": "#/responses/validationError"
}
}
}
},
"/repos/{owner}/{repo}/activities/feeds": {
"get": {
"produces": [
@ -18680,6 +18949,56 @@
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
"ActionWorkflow": {
"description": "ActionWorkflow represents a ActionWorkflow",
"type": "object",
"properties": {
"badge_url": {
"type": "string",
"x-go-name": "BadgeURL"
},
"created_at": {
"type": "string",
"format": "date-time",
"x-go-name": "CreatedAt"
},
"deleted_at": {
"type": "string",
"format": "date-time",
"x-go-name": "DeletedAt"
},
"html_url": {
"type": "string",
"x-go-name": "HTMLURL"
},
"id": {
"type": "string",
"x-go-name": "ID"
},
"name": {
"type": "string",
"x-go-name": "Name"
},
"path": {
"type": "string",
"x-go-name": "Path"
},
"state": {
"type": "string",
"x-go-name": "State"
},
"updated_at": {
"type": "string",
"format": "date-time",
"x-go-name": "UpdatedAt"
},
"url": {
"type": "string",
"x-go-name": "URL"
}
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
"Activity": {
"type": "object",
"properties": {
@ -19688,6 +20007,28 @@
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
"CreateActionWorkflowDispatch": {
"description": "CreateActionWorkflowDispatch represents the payload for triggering a workflow dispatch event",
"type": "object",
"required": [
"ref"
],
"properties": {
"inputs": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"x-go-name": "Inputs"
},
"ref": {
"type": "string",
"x-go-name": "Ref",
"example": "refs/heads/main"
}
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
"CreateBranchProtectionOption": {
"description": "CreateBranchProtectionOption options for creating a branch protection",
"type": "object",
@ -25687,6 +26028,21 @@
"$ref": "#/definitions/ActionVariable"
}
},
"ActionWorkflow": {
"description": "ActionWorkflow",
"schema": {
"$ref": "#/definitions/ActionWorkflow"
}
},
"ActionWorkflowList": {
"description": "ActionWorkflowList",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/ActionWorkflow"
}
}
},
"ActivityFeedsList": {
"description": "ActivityFeedsList",
"schema": {