tenseleyflow/shithub / cb06a79

Browse files

repo/actions: satisfy S41j-3 lint

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
cb06a79deb4637913dd572baf989d02f38ea0aca
Parents
c44c8a6
Tree
68254f4

2 changed files

StatusFile+-
M internal/actions/lifecycle/approval.go 1 25
M internal/web/handlers/repo/settings_actions.go 3 3
internal/actions/lifecycle/approval.gomodified
@@ -49,31 +49,7 @@ func ApproveRun(ctx context.Context, deps Deps, runID, actorUserID int64) (Appro
49
 }
49
 }
50
 
50
 
51
 func workflowRunFromApprovalRow(row actionsdb.ApproveWorkflowRunRow) actionsdb.WorkflowRun {
51
 func workflowRunFromApprovalRow(row actionsdb.ApproveWorkflowRunRow) actionsdb.WorkflowRun {
52
-	return actionsdb.WorkflowRun{
52
+	return actionsdb.WorkflowRun(row)
53
-		ID:               row.ID,
54
-		RepoID:           row.RepoID,
55
-		RunIndex:         row.RunIndex,
56
-		WorkflowFile:     row.WorkflowFile,
57
-		WorkflowName:     row.WorkflowName,
58
-		HeadSha:          row.HeadSha,
59
-		HeadRef:          row.HeadRef,
60
-		Event:            row.Event,
61
-		EventPayload:     row.EventPayload,
62
-		ActorUserID:      row.ActorUserID,
63
-		ParentRunID:      row.ParentRunID,
64
-		ConcurrencyGroup: row.ConcurrencyGroup,
65
-		Status:           row.Status,
66
-		Conclusion:       row.Conclusion,
67
-		Pinned:           row.Pinned,
68
-		NeedApproval:     row.NeedApproval,
69
-		ApprovedByUserID: row.ApprovedByUserID,
70
-		StartedAt:        row.StartedAt,
71
-		CompletedAt:      row.CompletedAt,
72
-		Version:          row.Version,
73
-		CreatedAt:        row.CreatedAt,
74
-		UpdatedAt:        row.UpdatedAt,
75
-		TriggerEventID:   row.TriggerEventID,
76
-	}
77
 }
53
 }
78
 
54
 
79
 // RejectRun turns a pending-approval run into a completed/action_required run
55
 // RejectRun turns a pending-approval run into a completed/action_required run
internal/web/handlers/repo/settings_actions.gomodified
@@ -162,12 +162,12 @@ func repoActionsPolicyFormFromRequest(r *http.Request) (repoActionsPolicyForm, e
162
 	switch form.ActionsEnabled {
162
 	switch form.ActionsEnabled {
163
 	case "inherit", "enabled", "disabled":
163
 	case "inherit", "enabled", "disabled":
164
 	default:
164
 	default:
165
-		return repoActionsPolicyForm{}, errors.New("Invalid Actions enablement setting.")
165
+		return repoActionsPolicyForm{}, errors.New("invalid Actions enablement setting")
166
 	}
166
 	}
167
 	switch form.RequirePRApproval {
167
 	switch form.RequirePRApproval {
168
 	case "inherit", "true", "false":
168
 	case "inherit", "true", "false":
169
 	default:
169
 	default:
170
-		return repoActionsPolicyForm{}, errors.New("Invalid pull request approval setting.")
170
+		return repoActionsPolicyForm{}, errors.New("invalid pull request approval setting")
171
 	}
171
 	}
172
 	for label, value := range map[string]string{
172
 	for label, value := range map[string]string{
173
 		"queued run cap":           form.MaxRepoQueuedRuns,
173
 		"queued run cap":           form.MaxRepoQueuedRuns,
@@ -176,7 +176,7 @@ func repoActionsPolicyFormFromRequest(r *http.Request) (repoActionsPolicyForm, e
176
 		"actor hourly trigger cap": form.ActorTriggerLimitPerHour,
176
 		"actor hourly trigger cap": form.ActorTriggerLimitPerHour,
177
 	} {
177
 	} {
178
 		if err := validateOptionalNonnegativeInt(value); err != nil {
178
 		if err := validateOptionalNonnegativeInt(value); err != nil {
179
-			return repoActionsPolicyForm{}, fmt.Errorf("Invalid %s.", label)
179
+			return repoActionsPolicyForm{}, fmt.Errorf("invalid %s", label)
180
 		}
180
 		}
181
 	}
181
 	}
182
 	return form, nil
182
 	return form, nil