summaryrefslogtreecommitdiffstats
path: root/modules/private/forgejo_actions.go
blob: 133d5e253f9079d6954923c3dc9fb2bedf039e66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// SPDX-License-Identifier: MIT

package private

import (
	"context"

	"code.gitea.io/gitea/modules/setting"
)

type ActionsRunnerRegisterRequest struct {
	Token   string
	Scope   string
	Labels  []string
	Name    string
	Version string
}

func ActionsRunnerRegister(ctx context.Context, token, scope string, labels []string, name, version string) (string, ResponseExtra) {
	reqURL := setting.LocalURL + "api/internal/actions/register"

	req := newInternalRequest(ctx, reqURL, "POST", ActionsRunnerRegisterRequest{
		Token:   token,
		Scope:   scope,
		Labels:  labels,
		Name:    name,
		Version: version,
	})

	resp, extra := requestJSONResp(req, &ResponseText{})
	return resp.Text, extra
}