gitea源码

actions.go 634B

1234567891011121314151617181920212223242526
  1. // Copyright 2023 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package private
  4. import (
  5. "context"
  6. "code.gitea.io/gitea/modules/setting"
  7. )
  8. type GenerateTokenRequest struct {
  9. Scope string
  10. }
  11. // GenerateActionsRunnerToken calls the internal GenerateActionsRunnerToken function
  12. func GenerateActionsRunnerToken(ctx context.Context, scope string) (*ResponseText, ResponseExtra) {
  13. reqURL := setting.LocalURL + "api/internal/actions/generate_actions_runner_token"
  14. req := newInternalRequestAPI(ctx, reqURL, "POST", GenerateTokenRequest{
  15. Scope: scope,
  16. })
  17. return requestJSONResp(req, &ResponseText{})
  18. }