diff --git a/routers/api/v1/repo/actions_run.go b/routers/api/v1/repo/actions_run.go index d3e62575c4..6c494b7b87 100644 --- a/routers/api/v1/repo/actions_run.go +++ b/routers/api/v1/repo/actions_run.go @@ -94,8 +94,8 @@ func RerunWorkflowRun(ctx *context.APIContext) { // required: true // - name: run // in: path - // description: run ID or "latest" - // type: string + // description: run ID + // type: integer // required: true // responses: // "200": @@ -169,8 +169,8 @@ func CancelWorkflowRun(ctx *context.APIContext) { // required: true // - name: run // in: path - // description: run ID or "latest" - // type: string + // description: run ID + // type: integer // required: true // responses: // "200": @@ -265,8 +265,8 @@ func ApproveWorkflowRun(ctx *context.APIContext) { // required: true // - name: run // in: path - // description: run ID or "latest" - // type: string + // description: run ID + // type: integer // required: true // responses: // "200": @@ -358,8 +358,8 @@ func RerunWorkflowJob(ctx *context.APIContext) { // required: true // - name: run // in: path - // description: run ID or "latest" - // type: string + // description: run ID + // type: integer // required: true // - name: job_id // in: path @@ -442,19 +442,6 @@ func RerunWorkflowJob(ctx *context.APIContext) { // Helper functions func getRunID(ctx *context.APIContext) (int64, *actions_model.ActionRun, error) { - // if run param is "latest", get the latest run - if ctx.PathParam("run") == "latest" { - run, err := actions_model.GetLatestRun(ctx, ctx.Repo.Repository.ID) - if err != nil { - return 0, nil, err - } - if run == nil { - return 0, nil, util.ErrNotExist - } - return run.ID, run, nil - } - - // Otherwise get run by ID runID := ctx.PathParamInt64("run") run, has, err := db.GetByID[actions_model.ActionRun](ctx, runID) if err != nil { @@ -584,8 +571,8 @@ func GetWorkflowRunLogs(ctx *context.APIContext) { // required: true // - name: run // in: path - // description: run ID or "latest" - // type: string + // description: run ID + // type: integer // required: true // responses: // "200": @@ -631,8 +618,8 @@ func GetWorkflowJobLogs(ctx *context.APIContext) { // required: true // - name: run // in: path - // description: run ID or "latest" - // type: string + // description: run ID + // type: integer // required: true // - name: job_id // in: path @@ -703,8 +690,8 @@ func GetWorkflowRunLogsStream(ctx *context.APIContext) { // required: true // - name: run // in: path - // description: run ID or "latest" - // type: string + // description: run ID + // type: integer // required: true // - name: job // in: query diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index db80a61f2e..4fd1c75136 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -5292,8 +5292,8 @@ "required": true }, { - "type": "string", - "description": "run ID or \"latest\"", + "type": "integer", + "description": "run ID", "name": "run", "in": "path", "required": true @@ -5393,8 +5393,8 @@ "required": true }, { - "type": "string", - "description": "run ID or \"latest\"", + "type": "integer", + "description": "run ID", "name": "run", "in": "path", "required": true @@ -5506,8 +5506,8 @@ "required": true }, { - "type": "string", - "description": "run ID or \"latest\"", + "type": "integer", + "description": "run ID", "name": "run", "in": "path", "required": true @@ -5556,8 +5556,8 @@ "required": true }, { - "type": "string", - "description": "run ID or \"latest\"", + "type": "integer", + "description": "run ID", "name": "run", "in": "path", "required": true @@ -5612,8 +5612,8 @@ "required": true }, { - "type": "string", - "description": "run ID or \"latest\"", + "type": "integer", + "description": "run ID", "name": "run", "in": "path", "required": true @@ -5656,8 +5656,8 @@ "required": true }, { - "type": "string", - "description": "run ID or \"latest\"", + "type": "integer", + "description": "run ID", "name": "run", "in": "path", "required": true @@ -5770,8 +5770,8 @@ "required": true }, { - "type": "string", - "description": "run ID or \"latest\"", + "type": "integer", + "description": "run ID", "name": "run", "in": "path", "required": true diff --git a/tests/integration/api_actions_run_test.go b/tests/integration/api_actions_run_test.go index af162aec26..117415ea57 100644 --- a/tests/integration/api_actions_run_test.go +++ b/tests/integration/api_actions_run_test.go @@ -154,10 +154,7 @@ func TestAPIActionsRerunWorkflowRun(t *testing.T) { AddTokenAuth(token) MakeRequest(t, req, http.StatusNotFound) - // Test rerun with "latest" parameter - req = NewRequest(t, "POST", fmt.Sprintf("/api/v1/repos/%s/actions/runs/latest/rerun", repo.FullName())). - AddTokenAuth(token) - MakeRequest(t, req, http.StatusOK) + } func TestAPIActionsRerunWorkflowRunPermissions(t *testing.T) {