mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-27 21:03:56 +01:00
4014200021
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>
27 lines
716 B
Go
27 lines
716 B
Go
// 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
|
|
}
|