2023-04-17 20:07:13 +03:00
|
|
|
// Copyright 2023 The Gitea Authors. All rights reserved.
|
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
|
|
|
|
package private
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"code.gitea.io/gitea/modules/setting"
|
|
|
|
)
|
|
|
|
|
|
|
|
type GenerateTokenRequest struct {
|
|
|
|
Scope string
|
|
|
|
}
|
|
|
|
|
|
|
|
// GenerateActionsRunnerToken calls the internal GenerateActionsRunnerToken function
|
2024-01-19 05:45:23 +03:00
|
|
|
func GenerateActionsRunnerToken(ctx context.Context, scope string) (*ResponseText, ResponseExtra) {
|
2023-04-17 20:07:13 +03:00
|
|
|
reqURL := setting.LocalURL + "api/internal/actions/generate_actions_runner_token"
|
|
|
|
|
|
|
|
req := newInternalRequest(ctx, reqURL, "POST", GenerateTokenRequest{
|
|
|
|
Scope: scope,
|
|
|
|
})
|
|
|
|
|
2024-01-19 05:45:23 +03:00
|
|
|
return requestJSONResp(req, &ResponseText{})
|
2023-04-17 20:07:13 +03:00
|
|
|
}
|