diff --git a/routers/api/v1/admin/runners.go b/routers/api/v1/admin/runners.go index 1e15b24076..f5aaea2c32 100644 --- a/routers/api/v1/admin/runners.go +++ b/routers/api/v1/admin/runners.go @@ -10,21 +10,6 @@ import ( // https://docs.github.com/en/rest/actions/self-hosted-runners?apiVersion=2022-11-28#create-a-registration-token-for-an-organization -// GetRegistrationToken returns the token to register global runners -func GetRegistrationToken(ctx *context.APIContext) { - // swagger:operation GET /admin/runners/registration-token admin adminGetRunnerRegistrationToken - // --- - // summary: Get a global actions runner registration token - // produces: - // - application/json - // parameters: - // responses: - // "200": - // "$ref": "#/responses/RegistrationToken" - - shared.GetRegistrationToken(ctx, 0, 0) -} - // CreateRegistrationToken returns the token to register global runners func CreateRegistrationToken(ctx *context.APIContext) { // swagger:operation POST /admin/actions/runners/registration-token admin adminCreateRunnerRegistrationToken diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index 9dc51bc907..50626cebbf 100644 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -917,7 +917,6 @@ func Routes() *web.Router { m.Group("/runners", func() { m.Get("", reqToken(), reqChecker, act.ListRunners) - m.Get("/registration-token", reqToken(), reqChecker, act.GetRegistrationToken) m.Post("/registration-token", reqToken(), reqChecker, act.CreateRegistrationToken) m.Get("/{runner_id}", reqToken(), reqChecker, act.GetRunner) m.Delete("/{runner_id}", reqToken(), reqChecker, act.DeleteRunner) @@ -1045,7 +1044,6 @@ func Routes() *web.Router { m.Group("/runners", func() { m.Get("", reqToken(), user.ListRunners) - m.Get("/registration-token", reqToken(), user.GetRegistrationToken) m.Post("/registration-token", reqToken(), user.CreateRegistrationToken) m.Get("/{runner_id}", reqToken(), user.GetRunner) m.Delete("/{runner_id}", reqToken(), user.DeleteRunner) @@ -1734,9 +1732,6 @@ func Routes() *web.Router { m.Get("/runs", admin.ListWorkflowRuns) m.Get("/jobs", admin.ListWorkflowJobs) }) - m.Group("/runners", func() { - m.Get("/registration-token", admin.GetRegistrationToken) - }) }, tokenRequiresScopes(auth_model.AccessTokenScopeCategoryAdmin), reqToken(), reqSiteAdmin()) m.Group("/topics", func() { diff --git a/routers/api/v1/org/action.go b/routers/api/v1/org/action.go index 59d8d3f2b4..d058964f52 100644 --- a/routers/api/v1/org/action.go +++ b/routers/api/v1/org/action.go @@ -170,27 +170,6 @@ func (Action) DeleteSecret(ctx *context.APIContext) { ctx.Status(http.StatusNoContent) } -// https://docs.github.com/en/rest/actions/self-hosted-runners?apiVersion=2022-11-28#create-a-registration-token-for-an-organization -// GetRegistrationToken returns the token to register org runners -func (Action) GetRegistrationToken(ctx *context.APIContext) { - // swagger:operation GET /orgs/{org}/actions/runners/registration-token organization orgGetRunnerRegistrationToken - // --- - // summary: Get an organization's actions runner registration token - // produces: - // - application/json - // parameters: - // - name: org - // in: path - // description: name of the organization - // type: string - // required: true - // responses: - // "200": - // "$ref": "#/responses/RegistrationToken" - - shared.GetRegistrationToken(ctx, ctx.Org.Organization.ID, 0) -} - // https://docs.github.com/en/rest/actions/self-hosted-runners?apiVersion=2022-11-28#create-a-registration-token-for-an-organization // CreateRegistrationToken returns the token to register org runners func (Action) CreateRegistrationToken(ctx *context.APIContext) { diff --git a/routers/api/v1/repo/action.go b/routers/api/v1/repo/action.go index a2124f5646..4c3a0dceff 100644 --- a/routers/api/v1/repo/action.go +++ b/routers/api/v1/repo/action.go @@ -510,31 +510,6 @@ func (Action) ListVariables(ctx *context.APIContext) { ctx.JSON(http.StatusOK, variables) } -// GetRegistrationToken returns the token to register repo runners -func (Action) GetRegistrationToken(ctx *context.APIContext) { - // swagger:operation GET /repos/{owner}/{repo}/actions/runners/registration-token repository repoGetRunnerRegistrationToken - // --- - // summary: Get a repository's actions runner registration token - // produces: - // - application/json - // parameters: - // - name: owner - // in: path - // description: owner of the repo - // type: string - // required: true - // - name: repo - // in: path - // description: name of the repo - // type: string - // required: true - // responses: - // "200": - // "$ref": "#/responses/RegistrationToken" - - shared.GetRegistrationToken(ctx, 0, ctx.Repo.Repository.ID) -} - // CreateRegistrationToken returns the token to register repo runners func (Action) CreateRegistrationToken(ctx *context.APIContext) { // swagger:operation POST /repos/{owner}/{repo}/actions/runners/registration-token repository repoCreateRunnerRegistrationToken diff --git a/routers/api/v1/user/runners.go b/routers/api/v1/user/runners.go index be3f63cc5e..77b0f59c1e 100644 --- a/routers/api/v1/user/runners.go +++ b/routers/api/v1/user/runners.go @@ -10,21 +10,6 @@ import ( // https://docs.github.com/en/rest/actions/self-hosted-runners?apiVersion=2022-11-28#create-a-registration-token-for-an-organization -// GetRegistrationToken returns the token to register user runners -func GetRegistrationToken(ctx *context.APIContext) { - // swagger:operation GET /user/actions/runners/registration-token user userGetRunnerRegistrationToken - // --- - // summary: Get an user's actions runner registration token - // produces: - // - application/json - // parameters: - // responses: - // "200": - // "$ref": "#/responses/RegistrationToken" - - shared.GetRegistrationToken(ctx, ctx.Doer.ID, 0) -} - // CreateRegistrationToken returns the token to register user runners func CreateRegistrationToken(ctx *context.APIContext) { // swagger:operation POST /user/actions/runners/registration-token user userCreateRunnerRegistrationToken diff --git a/services/actions/interface.go b/services/actions/interface.go index a054c38e4f..b1725550e1 100644 --- a/services/actions/interface.go +++ b/services/actions/interface.go @@ -23,8 +23,6 @@ type API interface { CreateVariable(*context.APIContext) // UpdateVariable update a variable UpdateVariable(*context.APIContext) - // GetRegistrationToken get registration token - GetRegistrationToken(*context.APIContext) // CreateRegistrationToken get registration token CreateRegistrationToken(*context.APIContext) // ListRunners list runners diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index 6ae0fc300b..644c9b3f83 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -564,23 +564,6 @@ } } }, - "/admin/runners/registration-token": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "admin" - ], - "summary": "Get a global actions runner registration token", - "operationId": "adminGetRunnerRegistrationToken", - "responses": { - "200": { - "$ref": "#/responses/RegistrationToken" - } - } - } - }, "/admin/unadopted": { "get": { "produces": [ @@ -1980,30 +1963,6 @@ } }, "/orgs/{org}/actions/runners/registration-token": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "organization" - ], - "summary": "Get an organization's actions runner registration token", - "operationId": "orgGetRunnerRegistrationToken", - "parameters": [ - { - "type": "string", - "description": "name of the organization", - "name": "org", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/RegistrationToken" - } - } - }, "post": { "produces": [ "application/json" @@ -4929,37 +4888,6 @@ } }, "/repos/{owner}/{repo}/actions/runners/registration-token": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "repository" - ], - "summary": "Get a repository's actions runner registration token", - "operationId": "repoGetRunnerRegistrationToken", - "parameters": [ - { - "type": "string", - "description": "owner of the repo", - "name": "owner", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "name of the repo", - "name": "repo", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/RegistrationToken" - } - } - }, "post": { "produces": [ "application/json" @@ -18416,21 +18344,6 @@ } }, "/user/actions/runners/registration-token": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "user" - ], - "summary": "Get an user's actions runner registration token", - "operationId": "userGetRunnerRegistrationToken", - "responses": { - "200": { - "$ref": "#/responses/RegistrationToken" - } - } - }, "post": { "produces": [ "application/json" diff --git a/tests/integration/actions_runner_test.go b/tests/integration/actions_runner_test.go index c0ed1e6644..3c48ce2409 100644 --- a/tests/integration/actions_runner_test.go +++ b/tests/integration/actions_runner_test.go @@ -83,7 +83,7 @@ func (r *mockRunner) doRegister(t *testing.T, name, token string, labels []strin func (r *mockRunner) registerAsRepoRunner(t *testing.T, ownerName, repoName, runnerName string, labels []string, ephemeral bool) { session := loginUser(t, ownerName) token := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeWriteRepository) - req := NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/%s/actions/runners/registration-token", ownerName, repoName)).AddTokenAuth(token) + req := NewRequest(t, http.MethodPost, fmt.Sprintf("/api/v1/repos/%s/%s/actions/runners/registration-token", ownerName, repoName)).AddTokenAuth(token) resp := MakeRequest(t, req, http.StatusOK) var registrationToken struct { Token string `json:"token"`