Skip to content

Commit 0655965

Browse files
committed
add swagger docu / fix build
1 parent f37caab commit 0655965

File tree

5 files changed

+410
-1
lines changed

5 files changed

+410
-1
lines changed

routers/api/v1/org/action.go

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,15 +466,82 @@ func (Action) UpdateVariable(ctx *context.APIContext) {
466466
ctx.Status(http.StatusNoContent)
467467
}
468468

469+
// GetRunners get org-level runners
469470
func (Action) GetRunners(ctx *context.APIContext) {
471+
// swagger:operation GET /orgs/{org}/actions/runners organization getRunners
472+
// ---
473+
// summary: Get org-level runners
474+
// produces:
475+
// - application/json
476+
// parameters:
477+
// - name: org
478+
// in: path
479+
// description: name of the organization
480+
// type: string
481+
// required: true
482+
// responses:
483+
// "200":
484+
// "$ref": "#/definitions/RunnerList"
485+
// "400":
486+
// "$ref": "#/responses/error"
487+
// "404":
488+
// "$ref": "#/responses/notFound"
470489
shared.GetRunners(ctx, ctx.Org.Organization.ID, 0)
471490
}
472491

492+
// GetRunner get an org-level runner
473493
func (Action) GetRunner(ctx *context.APIContext) {
494+
// swagger:operation GET /orgs/{org}/actions/runners/{runner_id} organization getRunner
495+
// ---
496+
// summary: Get an org-level runner
497+
// produces:
498+
// - application/json
499+
// parameters:
500+
// - name: org
501+
// in: path
502+
// description: name of the organization
503+
// type: string
504+
// required: true
505+
// - name: runner_id
506+
// in: path
507+
// description: id of the runner
508+
// type: string
509+
// required: true
510+
// responses:
511+
// "200":
512+
// "$ref": "#/definitions/Runner"
513+
// "400":
514+
// "$ref": "#/responses/error"
515+
// "404":
516+
// "$ref": "#/responses/notFound"
474517
shared.GetRunner(ctx, ctx.Org.Organization.ID, 0, ctx.PathParamInt64("runner_id"))
475518
}
476519

520+
// DeleteRunner delete an org-level runner
477521
func (Action) DeleteRunner(ctx *context.APIContext) {
522+
// swagger:operation GET /orgs/{org}/actions/runners/{runner_id} organization deleteRunner
523+
// ---
524+
// summary: Delete an org-level runner
525+
// produces:
526+
// - application/json
527+
// parameters:
528+
// - name: org
529+
// in: path
530+
// description: name of the organization
531+
// type: string
532+
// required: true
533+
// - name: runner_id
534+
// in: path
535+
// description: id of the runner
536+
// type: string
537+
// required: true
538+
// responses:
539+
// "204":
540+
// description: runner has been deleted
541+
// "400":
542+
// "$ref": "#/responses/error"
543+
// "404":
544+
// "$ref": "#/responses/notFound"
478545
shared.DeleteRunner(ctx, ctx.Org.Organization.ID, 0, ctx.PathParamInt64("runner_id"))
479546
}
480547

routers/api/v1/repo/action.go

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,15 +526,97 @@ func (Action) GetRegistrationToken(ctx *context.APIContext) {
526526
shared.GetRegistrationToken(ctx, 0, ctx.Repo.Repository.ID)
527527
}
528528

529+
// GetRunners get repo-level runners
529530
func (Action) GetRunners(ctx *context.APIContext) {
531+
// swagger:operation GET /repos/{owner}/{repo}/actions/runners organization getRunners
532+
// ---
533+
// summary: Get repo-level runners
534+
// produces:
535+
// - application/json
536+
// parameters:
537+
// - name: owner
538+
// in: path
539+
// description: owner of the repo
540+
// type: string
541+
// required: true
542+
// - name: repo
543+
// in: path
544+
// description: name of the repo
545+
// type: string
546+
// required: true
547+
// responses:
548+
// "200":
549+
// "$ref": "#/definitions/RunnerList"
550+
// "400":
551+
// "$ref": "#/responses/error"
552+
// "404":
553+
// "$ref": "#/responses/notFound"
530554
shared.GetRunners(ctx, 0, ctx.Repo.Repository.ID)
531555
}
532556

557+
// GetRunner get an repo-level runner
533558
func (Action) GetRunner(ctx *context.APIContext) {
559+
// swagger:operation GET /repos/{owner}/{repo}/actions/runners/{runner_id} organization getRunner
560+
// ---
561+
// summary: Get an repo-level runner
562+
// produces:
563+
// - application/json
564+
// parameters:
565+
// - name: owner
566+
// in: path
567+
// description: owner of the repo
568+
// type: string
569+
// required: true
570+
// - name: repo
571+
// in: path
572+
// description: name of the repo
573+
// type: string
574+
// required: true
575+
// - name: runner_id
576+
// in: path
577+
// description: id of the runner
578+
// type: string
579+
// required: true
580+
// responses:
581+
// "200":
582+
// "$ref": "#/definitions/Runner"
583+
// "400":
584+
// "$ref": "#/responses/error"
585+
// "404":
586+
// "$ref": "#/responses/notFound"
534587
shared.GetRunner(ctx, 0, ctx.Repo.Repository.ID, ctx.PathParamInt64("runner_id"))
535588
}
536589

590+
// DeleteRunner delete an repo-level runner
537591
func (Action) DeleteRunner(ctx *context.APIContext) {
592+
// swagger:operation GET /repos/{owner}/{repo}/actions/runners/{runner_id} organization deleteRunner
593+
// ---
594+
// summary: Delete an repo-level runner
595+
// produces:
596+
// - application/json
597+
// parameters:
598+
// - name: owner
599+
// in: path
600+
// description: owner of the repo
601+
// type: string
602+
// required: true
603+
// - name: repo
604+
// in: path
605+
// description: name of the repo
606+
// type: string
607+
// required: true
608+
// - name: runner_id
609+
// in: path
610+
// description: id of the runner
611+
// type: string
612+
// required: true
613+
// responses:
614+
// "204":
615+
// description: runner has been deleted
616+
// "400":
617+
// "$ref": "#/responses/error"
618+
// "404":
619+
// "$ref": "#/responses/notFound"
538620
shared.DeleteRunner(ctx, 0, ctx.Repo.Repository.ID, ctx.PathParamInt64("runner_id"))
539621
}
540622

routers/api/v1/swagger/repo.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,20 @@ type swaggerRepoArtifact struct {
457457
Body api.ActionArtifact `json:"body"`
458458
}
459459

460+
// RunnerList
461+
// swagger:response RunnerList
462+
type swaggerRunnerList struct {
463+
// in:body
464+
Body api.ActionRunnersResponse `json:"body"`
465+
}
466+
467+
// Runner
468+
// swagger:response Runner
469+
type swaggerRunner struct {
470+
// in:body
471+
Body api.ActionRunner `json:"body"`
472+
}
473+
460474
// swagger:response Compare
461475
type swaggerCompare struct {
462476
// in:body

services/convert/convert.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ func ToActionRunner(ctx context.Context, runner *actions_model.ActionRunner) *ap
273273
OS: "Unknown",
274274
Status: apiStatus,
275275
Busy: status == runnerv1.RunnerStatus_RUNNER_STATUS_ACTIVE,
276-
Ephemeral: runner.Ephemeral,
276+
Ephemeral: false, // TODO runner.Ephemeral
277277
Labels: labels,
278278
}
279279
}

0 commit comments

Comments
 (0)