Skip to content

Commit 8cfb047

Browse files
committed
fix lint
1 parent b650ca9 commit 8cfb047

File tree

7 files changed

+270
-9
lines changed

7 files changed

+270
-9
lines changed

modules/actions/workflows.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ func matchWorkflowRunEvent(payload *api.WorkflowRunPayload, evt *jobparser.Event
716716
case "types":
717717
action := payload.Action
718718
for _, val := range vals {
719-
if glob.MustCompile(val, '/').Match(string(action)) {
719+
if glob.MustCompile(val, '/').Match(action) {
720720
matchTimes++
721721
break
722722
}

routers/api/v1/repo/action.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,6 @@ func GetWorkflowRun(ctx *context.APIContext) {
10171017
return
10181018
}
10191019
ctx.JSON(http.StatusOK, convertedArtifact)
1020-
return
10211020
}
10221021

10231022
// GetWorkflowJobs Lists all jobs for a workflow run.
@@ -1130,7 +1129,6 @@ func GetWorkflowJob(ctx *context.APIContext) {
11301129
return
11311130
}
11321131
ctx.JSON(http.StatusOK, convertedWorkflowJob)
1133-
return
11341132
}
11351133

11361134
// GetArtifacts Lists all artifacts for a repository.

services/actions/notifier.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
issues_model "code.gitea.io/gitea/models/issues"
1111
"code.gitea.io/gitea/models/organization"
1212
packages_model "code.gitea.io/gitea/models/packages"
13-
"code.gitea.io/gitea/models/perm"
1413
perm_model "code.gitea.io/gitea/models/perm"
1514
access_model "code.gitea.io/gitea/models/perm/access"
1615
repo_model "code.gitea.io/gitea/models/repo"
@@ -785,7 +784,10 @@ func (n *actionsNotifier) WorkflowRunStatusUpdate(ctx context.Context, repo *rep
785784
defer gitRepo.Close()
786785

787786
convertedWorkflow, err := convert.GetActionWorkflow(ctx, gitRepo, repo, run.WorkflowID)
788-
787+
if err != nil {
788+
log.Error("GetActionWorkflow: %v", err)
789+
return
790+
}
789791
convertedRun, err := convert.ToActionWorkflowRun(ctx, repo, run)
790792
if err != nil {
791793
log.Error("ToActionWorkflowRun: %v", err)
@@ -797,7 +799,7 @@ func (n *actionsNotifier) WorkflowRunStatusUpdate(ctx context.Context, repo *rep
797799
Workflow: convertedWorkflow,
798800
WorkflowRun: convertedRun,
799801
Organization: org,
800-
Repo: convert.ToRepo(ctx, repo, access_model.Permission{AccessMode: perm.AccessModeOwner}),
802+
Repo: convert.ToRepo(ctx, repo, access_model.Permission{AccessMode: perm_model.AccessModeOwner}),
801803
Sender: convert.ToUser(ctx, sender, nil),
802804
}).Notify(ctx)
803805
}

services/convert/convert.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,10 @@ func ToActionTask(ctx context.Context, t *actions_model.ActionTask) (*api.Action
235235
}
236236

237237
func ToActionWorkflowRun(ctx context.Context, repo *repo_model.Repository, run *actions_model.ActionRun) (*api.ActionWorkflowRun, error) {
238-
run.LoadRepo(ctx)
238+
err := run.LoadRepo(ctx)
239+
if err != nil {
240+
return nil, err
241+
}
239242
status, conclusion := ToActionsStatus(run.Status)
240243
return &api.ActionWorkflowRun{
241244
ID: run.ID,

services/webhook/notifier.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -995,6 +995,10 @@ func (*webhookNotifier) WorkflowRunStatusUpdate(ctx context.Context, repo *repo_
995995
defer gitRepo.Close()
996996

997997
convertedWorkflow, err := convert.GetActionWorkflow(ctx, gitRepo, repo, run.WorkflowID)
998+
if err != nil {
999+
log.Error("GetActionWorkflow: %v", err)
1000+
return
1001+
}
9981002

9991003
convertedRun, err := convert.ToActionWorkflowRun(ctx, repo, run)
10001004
if err != nil {

templates/swagger/v1_json.tmpl

Lines changed: 254 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/integration/repo_webhook_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ jobs:
707707
assert.EqualValues(t, commitID, payloads[3].WorkflowJob.HeadSha)
708708
assert.EqualValues(t, "repo1", payloads[3].Repo.Name)
709709
assert.EqualValues(t, "user2/repo1", payloads[3].Repo.FullName)
710-
assert.Contains(t, payloads[3].WorkflowJob.URL, fmt.Sprintf("/actions/runs/%d/jobs/%d", payloads[3].WorkflowJob.RunID, payloads[3].WorkflowJob.ID))
710+
assert.Contains(t, payloads[3].WorkflowJob.URL, fmt.Sprintf("/actions/jobs/%d", payloads[3].WorkflowJob.ID))
711711
assert.Contains(t, payloads[3].WorkflowJob.URL, payloads[3].WorkflowJob.RunURL)
712712
assert.Contains(t, payloads[3].WorkflowJob.HTMLURL, fmt.Sprintf("/jobs/%d", 0))
713713
assert.Len(t, payloads[3].WorkflowJob.Steps, 1)
@@ -745,7 +745,7 @@ jobs:
745745
assert.EqualValues(t, commitID, payloads[6].WorkflowJob.HeadSha)
746746
assert.EqualValues(t, "repo1", payloads[6].Repo.Name)
747747
assert.EqualValues(t, "user2/repo1", payloads[6].Repo.FullName)
748-
assert.Contains(t, payloads[6].WorkflowJob.URL, fmt.Sprintf("/actions/runs/%d/jobs/%d", payloads[6].WorkflowJob.RunID, payloads[6].WorkflowJob.ID))
748+
assert.Contains(t, payloads[6].WorkflowJob.URL, fmt.Sprintf("/actions/jobs/%d", payloads[6].WorkflowJob.ID))
749749
assert.Contains(t, payloads[6].WorkflowJob.URL, payloads[6].WorkflowJob.RunURL)
750750
assert.Contains(t, payloads[6].WorkflowJob.HTMLURL, fmt.Sprintf("/jobs/%d", 1))
751751
assert.Len(t, payloads[6].WorkflowJob.Steps, 2)

0 commit comments

Comments
 (0)