aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authortechknowlogick <techknowlogick@gitea.io>2023-04-17 13:07:13 -0400
committerGitHub <noreply@github.com>2023-04-17 13:07:13 -0400
commit4014200021a1997283c779a815fe9e5febf1fda1 (patch)
tree1ef45d3e316cfc1fd31a35fcf69aa88c230f931a /modules
parent1819c4b59b81ba4db2a38d3b3dc81f29102fde51 (diff)
downloadgitea-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.go27
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
+}