forgejo/routers/api/v1/admin/runners.go
Manuel Ganter ffdda77325
Some checks failed
testing-integration / test-unit (push) Failing after 0s
testing-integration / test-sqlite (push) Failing after 0s
testing-integration / test-mariadb (v10.6) (push) Failing after 0s
testing-integration / test-mariadb (v11.8) (push) Failing after 0s
testing / backend-checks (push) Failing after 0s
testing / frontend-checks (push) Failing after 0s
testing / test-unit (push) Failing after 0s
testing / test-remote-cacher (garnet) (push) Failing after 0s
testing / test-remote-cacher (redict) (push) Failing after 0s
testing / security-check (push) Failing after 0s
testing / test-e2e (push) Failing after 0s
testing / test-mysql (push) Failing after 0s
testing / test-pgsql (push) Failing after 0s
testing / test-sqlite (push) Failing after 0s
testing / test-remote-cacher (redis) (push) Failing after 0s
testing / test-remote-cacher (valkey) (push) Failing after 0s
/ release (push) Has been cancelled
introduced api endpoint for retrieving runner api tokens, defined by
github api spec
2025-08-28 16:07:08 +02:00

124 lines
3.5 KiB
Go

// Copyright 2023 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package admin
import (
"forgejo.org/routers/api/v1/shared"
"forgejo.org/services/context"
)
// https://docs.github.com/en/rest/actions/self-hosted-runners?apiVersion=2022-11-28#create-a-registration-token-for-an-organization
// GetRegistrationToken returns the token to register global runners
func GetRegistrationToken(ctx *context.APIContext) {
// swagger:operation GET /admin/runners/registration-token admin adminGetRunnerRegistrationToken
// ---
// summary: Get an global actions runner registration token
// produces:
// - application/json
// parameters:
// responses:
// "200":
// "$ref": "#/responses/RegistrationToken"
shared.GetRegistrationToken(ctx, 0, 0)
}
// SearchActionRunJobs return a list of actions jobs filtered by the provided parameters
func SearchActionRunJobs(ctx *context.APIContext) {
// swagger:operation GET /admin/runners/jobs admin adminSearchRunJobs
// ---
// summary: Search action jobs according filter conditions
// produces:
// - application/json
// parameters:
// - name: labels
// in: query
// description: a comma separated list of run job labels to search for
// type: string
// responses:
// "200":
// "$ref": "#/responses/RunJobList"
// "403":
// "$ref": "#/responses/forbidden"
shared.GetActionRunJobs(ctx, 0, 0)
}
// CreateRegistrationToken returns the token to register global runners
func CreateRegistrationToken(ctx *context.APIContext) {
// swagger:operation POST /admin/actions/runners/registration-token admin adminCreateRunnerRegistrationToken
// ---
// summary: Get an global actions runner registration token
// produces:
// - application/json
// parameters:
// responses:
// "200":
// "$ref": "#/responses/RegistrationToken"
shared.GetRegistrationToken(ctx, 0, 0)
}
// ListRunners get all runners
func ListRunners(ctx *context.APIContext) {
// swagger:operation GET /admin/actions/runners admin getAdminRunners
// ---
// summary: Get all runners
// produces:
// - application/json
// responses:
// "200":
// "$ref": "#/definitions/ActionRunnersResponse"
// "400":
// "$ref": "#/responses/error"
// "404":
// "$ref": "#/responses/notFound"
shared.ListRunners(ctx, 0, 0)
}
// GetRunner get an global runner
func GetRunner(ctx *context.APIContext) {
// swagger:operation GET /admin/actions/runners/{runner_id} admin getAdminRunner
// ---
// summary: Get an global runner
// produces:
// - application/json
// parameters:
// - name: runner_id
// in: path
// description: id of the runner
// type: string
// required: true
// responses:
// "200":
// "$ref": "#/definitions/ActionRunner"
// "400":
// "$ref": "#/responses/error"
// "404":
// "$ref": "#/responses/notFound"
shared.GetRunner(ctx, 0, 0, ctx.ParamsInt64("runner_id"))
}
// DeleteRunner delete an global runner
func DeleteRunner(ctx *context.APIContext) {
// swagger:operation DELETE /admin/actions/runners/{runner_id} admin deleteAdminRunner
// ---
// summary: Delete an global runner
// produces:
// - application/json
// parameters:
// - name: runner_id
// in: path
// description: id of the runner
// type: string
// required: true
// responses:
// "204":
// description: runner has been deleted
// "400":
// "$ref": "#/responses/error"
// "404":
// "$ref": "#/responses/notFound"
shared.DeleteRunner(ctx, 0, 0, ctx.ParamsInt64("runner_id"))
}