diff options
author | techknowlogick <techknowlogick@gitea.io> | 2023-04-17 13:07:13 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-17 13:07:13 -0400 |
commit | 4014200021a1997283c779a815fe9e5febf1fda1 (patch) | |
tree | 1ef45d3e316cfc1fd31a35fcf69aa88c230f931a /modules | |
parent | 1819c4b59b81ba4db2a38d3b3dc81f29102fde51 (diff) | |
download | gitea-4014200021a1997283c779a815fe9e5febf1fda1.tar.gz gitea-4014200021a1997283c779a815fe9e5febf1fda1.zip |
add CLI command to register runner tokens (#23762)
This is a CLI command to generate new tokens for the runners to register
with
Fix https://github.com/go-gitea/gitea/issues/23643
---------
Co-authored-by: delvh <dev.lh@web.de>
Diffstat (limited to 'modules')
-rw-r--r-- | modules/private/actions.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/modules/private/actions.go b/modules/private/actions.go new file mode 100644 index 0000000000..be24e16d3f --- /dev/null +++ b/modules/private/actions.go @@ -0,0 +1,27 @@ +// Copyright 2023 The Gitea Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package private + +import ( + "context" + + "code.gitea.io/gitea/modules/setting" +) + +// Email structure holds a data for sending general emails +type GenerateTokenRequest struct { + Scope string +} + +// GenerateActionsRunnerToken calls the internal GenerateActionsRunnerToken function +func GenerateActionsRunnerToken(ctx context.Context, scope string) (string, ResponseExtra) { + reqURL := setting.LocalURL + "api/internal/actions/generate_actions_runner_token" + + req := newInternalRequest(ctx, reqURL, "POST", GenerateTokenRequest{ + Scope: scope, + }) + + resp, extra := requestJSONResp(req, &responseText{}) + return resp.Text, extra +} |