From 9f842f0dec6a20edcaae47d91b78028e52ad24f3 Mon Sep 17 00:00:00 2001 From: Jaime merino Date: Tue, 14 Jan 2025 11:17:42 +0000 Subject: Add search action jobs for API routes, repo, org and global level (#6300) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR wants to improve information of the tasks waiting to be executed on a global, organization, user and repository leve. The main motivation is explained here https://codeberg.org/forgejo/discussions/issues/241 ## Checklist The [contributor guide](https://forgejo.org/docs/next/contributor/) contains information that will be helpful to first time contributors. There also are a few [conditions for merging Pull Requests in Forgejo repositories](https://codeberg.org/forgejo/governance/src/branch/main/PullRequestsAgreement.md). You are also welcome to join the [Forgejo development chatroom](https://matrix.to/#/#forgejo-development:matrix.org). ### Tests - I added test coverage for Go changes... - [x] in their respective `*_test.go` for unit tests. - [x] in the `tests/integration` directory if it involves interactions with a live Forgejo server. - I added test coverage for JavaScript changes... - [ ] in `web_src/js/*.test.js` if it can be unit tested. - [ ] in `tests/e2e/*.test.e2e.js` if it requires interactions with a live Forgejo server (see also the [developer guide for JavaScript testing](https://codeberg.org/forgejo/forgejo/src/branch/forgejo/tests/e2e/README.md#end-to-end-tests)). ### Documentation - [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change. - [x] I did not document these changes and I do not expect someone else to do it. ### Release notes - [ ] I do not want this change to show in the release notes. - [x] I want the title to show in the release notes with a link to this pull request. - [ ] I want the content of the `release-notes/.md` to be be used for the release notes instead of the title. ## Release notes - Features - [PR](https://codeberg.org/forgejo/forgejo/pulls/6300): Add search action jobs for API routes, repo, org and global level Co-authored-by: jaime merino Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6300 Reviewed-by: Earl Warren Co-authored-by: Jaime merino Co-committed-by: Jaime merino --- templates/swagger/v1_json.tmpl | 202 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 202 insertions(+) (limited to 'templates') diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index f726176883..1832e9d732 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -992,6 +992,34 @@ } } }, + "/admin/runners/jobs": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "admin" + ], + "summary": "Search action jobs according filter conditions", + "operationId": "adminSearchRunJobs", + "parameters": [ + { + "type": "string", + "description": "a comma separated list of run job labels to search for", + "name": "labels", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/RunJobList" + }, + "403": { + "$ref": "#/responses/forbidden" + } + } + } + }, "/admin/runners/registration-token": { "get": { "produces": [ @@ -2284,6 +2312,41 @@ } } }, + "/orgs/{org}/actions/runners/jobs": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Search for organization's action jobs according filter conditions", + "operationId": "orgSearchRunJobs", + "parameters": [ + { + "type": "string", + "description": "name of the organization", + "name": "org", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "a comma separated list of run job labels to search for", + "name": "labels", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/RunJobList" + }, + "403": { + "$ref": "#/responses/forbidden" + } + } + } + }, "/orgs/{org}/actions/runners/registration-token": { "get": { "produces": [ @@ -4639,6 +4702,48 @@ } } }, + "/repos/{owner}/{repo}/actions/runners/jobs": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Search for repository's action jobs according filter conditions", + "operationId": "repoSearchRunJobs", + "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": "a comma separated list of run job labels to search for", + "name": "labels", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/RunJobList" + }, + "403": { + "$ref": "#/responses/forbidden" + } + } + } + }, "/repos/{owner}/{repo}/actions/runners/registration-token": { "get": { "produces": [ @@ -17399,6 +17504,37 @@ } } }, + "/user/actions/runners/jobs": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Search for user's action jobs according filter conditions", + "operationId": "userSearchRunJobs", + "parameters": [ + { + "type": "string", + "description": "a comma separated list of run job labels to search for", + "name": "labels", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/RunJobList" + }, + "401": { + "$ref": "#/responses/unauthorized" + }, + "403": { + "$ref": "#/responses/forbidden" + } + } + } + }, "/user/actions/runners/registration-token": { "get": { "produces": [ @@ -20387,6 +20523,63 @@ }, "x-go-package": "code.gitea.io/gitea/modules/structs" }, + "ActionRunJob": { + "description": "ActionRunJob represents a job of a run", + "type": "object", + "properties": { + "id": { + "description": "the action run job id", + "type": "integer", + "format": "int64", + "x-go-name": "ID" + }, + "name": { + "description": "the action run job name", + "type": "string", + "x-go-name": "Name" + }, + "needs": { + "description": "the action run job needed ids", + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "Needs" + }, + "owner_id": { + "description": "the owner id", + "type": "integer", + "format": "int64", + "x-go-name": "OwnerID" + }, + "repo_id": { + "description": "the repository id", + "type": "integer", + "format": "int64", + "x-go-name": "RepoID" + }, + "runs_on": { + "description": "the action run job labels to run on", + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "RunsOn" + }, + "status": { + "description": "the action run job status", + "type": "string", + "x-go-name": "Status" + }, + "task_id": { + "description": "the action run job latest task id", + "type": "integer", + "format": "int64", + "x-go-name": "TaskID" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, "ActionTask": { "description": "ActionTask represents a ActionTask", "type": "object", @@ -28678,6 +28871,15 @@ } } }, + "RunJobList": { + "description": "RunJobList is a list of action run jobs", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/ActionRunJob" + } + } + }, "SearchResults": { "description": "SearchResults", "schema": { -- cgit v1.2.3