Skip to content

Commit 1180237

Browse files
committed
fix lint
1 parent a383b13 commit 1180237

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

models/actions/run.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,11 @@ func CancelPreviousJobs(ctx context.Context, repoID int64, ref, workflowID strin
226226
return cancelledJobs, err
227227
}
228228

229-
if cjs, err := CancelJobs(ctx, jobs); err != nil {
229+
cjs, err := CancelJobs(ctx, jobs)
230+
if err != nil {
230231
return cancelledJobs, err
231-
} else {
232-
cancelledJobs = append(cancelledJobs, cjs...)
233232
}
233+
cancelledJobs = append(cancelledJobs, cjs...)
234234
}
235235

236236
// Return nil to indicate successful cancellation of all running and waiting jobs.

models/actions/run_job.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -259,11 +259,11 @@ func CancelPreviousJobsByConcurrency(ctx context.Context, job *ActionRunJob) ([]
259259
return cancelledJobs, fmt.Errorf("find previous jobs: %w", err)
260260
}
261261
previousJobs = slices.DeleteFunc(previousJobs, func(j *ActionRunJob) bool { return j.ID == job.ID })
262-
if cjs, err := CancelJobs(ctx, previousJobs); err != nil {
262+
cjs, err := CancelJobs(ctx, previousJobs)
263+
if err != nil {
263264
return cancelledJobs, fmt.Errorf("cancel previous jobs: %w", err)
264-
} else {
265-
cancelledJobs = append(cancelledJobs, cjs...)
266265
}
266+
cancelledJobs = append(cancelledJobs, cjs...)
267267
}
268268
}
269269

@@ -290,11 +290,11 @@ func CancelPreviousJobsByConcurrency(ctx context.Context, job *ActionRunJob) ([]
290290
if err != nil {
291291
return cancelledJobs, fmt.Errorf("find run %d jobs: %w", run.ID, err)
292292
}
293-
if cjs, err := CancelJobs(ctx, jobs); err != nil {
293+
cjs, err := CancelJobs(ctx, jobs)
294+
if err != nil {
294295
return cancelledJobs, fmt.Errorf("cancel run %d jobs: %w", run.ID, err)
295-
} else {
296-
cancelledJobs = append(cancelledJobs, cjs...)
297296
}
297+
cancelledJobs = append(cancelledJobs, cjs...)
298298
}
299299
}
300300

tests/integration/actions_concurrency_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ jobs:
805805
assert.Equal(t, "workflow-group-2", w3Run.ConcurrencyGroup)
806806
assert.Equal(t, "concurrent-workflow-3.yml", w3Run.WorkflowID)
807807
// push workflow-4
808-
opts4 := getWorkflowCreateFileOptions(user2, repo.DefaultBranch, fmt.Sprintf("create %s", wf4TreePath), wf4FileContent)
808+
opts4 := getWorkflowCreateFileOptions(user2, repo.DefaultBranch, "create %s"+wf4TreePath, wf4FileContent)
809809
createWorkflowFile(t, token, user2.Name, repo.Name, wf4TreePath, opts4)
810810
// exec wf1-job2
811811
runner2.execTask(t, w1j2Task, &mockTaskOutcome{

0 commit comments

Comments
 (0)