mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-03-25 11:43:06 -04:00
Add an HTTP API endpoint for runner registration. It enables managing the entire runner lifecycle using Forgejo's HTTP API. See https://code.forgejo.org/forgejo/forgejo-actions-feature-requests/issues/78 for background, design considerations, and usage. Example usage: ``` $ curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: token 3fc3ef39805b0f811a5d7789cb7b448348d6bfbb" --data '{"name":"api-runner","description":"Lorem ipsum"}' http://localhost:3000/api/v1/user/actions/runners ``` ```json {"id":30,"uuid":"a5e33697-9f58-437d-83c3-551b6c6a6334","token":"cac45fa6726fe4e28f42598773671af28a3be121"} ``` ## 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... - [ ] 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. - [ ] 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. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/10677 Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org> Co-authored-by: Andreas Ahlenstorf <andreas@ahlenstorf.ch> Co-committed-by: Andreas Ahlenstorf <andreas@ahlenstorf.ch>
38 lines
1.2 KiB
Go
38 lines
1.2 KiB
Go
// Copyright 2024 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package actions
|
|
|
|
import "forgejo.org/services/context"
|
|
|
|
// API for actions of a repository or organization
|
|
type API interface {
|
|
// ListActionsSecrets list secrets
|
|
ListActionsSecrets(*context.APIContext)
|
|
// CreateOrUpdateSecret create or update a secret
|
|
CreateOrUpdateSecret(*context.APIContext)
|
|
// DeleteSecret delete a secret
|
|
DeleteSecret(*context.APIContext)
|
|
// ListVariables list variables
|
|
ListVariables(*context.APIContext)
|
|
// GetVariable get a variable
|
|
GetVariable(*context.APIContext)
|
|
// DeleteVariable delete a variable
|
|
DeleteVariable(*context.APIContext)
|
|
// CreateVariable create a variable
|
|
CreateVariable(*context.APIContext)
|
|
// UpdateVariable update a variable
|
|
UpdateVariable(*context.APIContext)
|
|
// GetRegistrationToken get registration token
|
|
GetRegistrationToken(*context.APIContext)
|
|
// SearchActionRunJobs get pending Action run jobs
|
|
SearchActionRunJobs(*context.APIContext)
|
|
// ListRunners list runners
|
|
ListRunners(*context.APIContext)
|
|
// GetRunner get a runner
|
|
GetRunner(*context.APIContext)
|
|
// RegisterRunner registers a new runner
|
|
RegisterRunner(*context.APIContext)
|
|
// DeleteRunner delete runner
|
|
DeleteRunner(*context.APIContext)
|
|
}
|