1
Fork 0

Add search action jobs for API routes, repo, org and global level (#6300)

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/<pull request number>.md` to be be used for the release notes instead of the title.

<!--start release-notes-assistant-->

## Release notes
<!--URL:https://codeberg.org/forgejo/forgejo-->
- Features
  - [PR](https://codeberg.org/forgejo/forgejo/pulls/6300): <!--number 6300 --><!--line 0 --><!--description QWRkIHNlYXJjaCBhY3Rpb24gam9icyBmb3IgQVBJIHJvdXRlcywgcmVwbywgb3JnIGFuZCBnbG9iYWwgbGV2ZWw=-->Add search action jobs for API routes, repo, org and global level<!--description-->
<!--end release-notes-assistant-->

Co-authored-by: jaime merino <jaime.merino_mora@mail.schwarzª>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6300
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Jaime merino <cobak78@gmail.com>
Co-committed-by: Jaime merino <cobak78@gmail.com>
This commit is contained in:
Jaime merino 2025-01-14 11:17:42 +00:00 committed by Earl Warren
parent a013acb632
commit 9f842f0dec
22 changed files with 640 additions and 22 deletions

View file

@ -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": {