Skip to content

Commit 4a1d263

Browse files
committed
Improve the API changes
1 parent a2f23db commit 4a1d263

File tree

5 files changed

+39
-4
lines changed

5 files changed

+39
-4
lines changed

routers/api/v1/admin/runners.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ func GetRegistrationToken(ctx *context.APIContext) {
1818
// produces:
1919
// - application/json
2020
// parameters:
21+
// - name: set-token
22+
// in: body
23+
// description: set a runner register token instead of generating one.
24+
// type: string
25+
// required: false
2126
// responses:
2227
// "200":
2328
// "$ref": "#/responses/RegistrationToken"

routers/api/v1/org/action.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,11 @@ func (Action) GetRegistrationToken(ctx *context.APIContext) {
182182
// description: name of the organization
183183
// type: string
184184
// required: true
185+
// - name: set-token
186+
// in: body
187+
// description: set a runner register token instead of generating one.
188+
// type: string
189+
// required: false
185190
// responses:
186191
// "200":
187192
// "$ref": "#/responses/RegistrationToken"

routers/api/v1/repo/action.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,11 @@ func (Action) GetRegistrationToken(ctx *context.APIContext) {
500500
// description: name of the repo
501501
// type: string
502502
// required: true
503+
// - name: set-token
504+
// in: body
505+
// description: set a runner register token instead of generating one.
506+
// type: string
507+
// required: false
503508
// responses:
504509
// "200":
505510
// "$ref": "#/responses/RegistrationToken"

routers/api/v1/shared/runners.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ type RegistrationToken struct {
1919
}
2020

2121
func GetRegistrationToken(ctx *context.APIContext, ownerID, repoID int64) {
22-
putToken := ctx.FormString("put-token")
22+
setToken := ctx.FormString("set-token")
2323
var token *actions_model.ActionRunnerToken
2424
var err error
25-
if putToken == "" {
25+
if setToken == "" {
2626
token, err = actions_model.GetLatestRunnerToken(ctx, ownerID, repoID)
2727
}
28-
if putToken != "" || errors.Is(err, util.ErrNotExist) || (token != nil && !token.IsActive) {
29-
token, err = actions_model.NewRunnerToken(ctx, ownerID, repoID, putToken)
28+
if setToken != "" || errors.Is(err, util.ErrNotExist) || (token != nil && !token.IsActive) {
29+
token, err = actions_model.NewRunnerToken(ctx, ownerID, repoID, setToken)
3030
}
3131
if err != nil {
3232
ctx.InternalServerError(err)

templates/swagger/v1_json.tmpl

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)