diff --git a/services/convert/convert.go b/services/convert/convert.go index 5df9b2d8db..744153d8c3 100644 --- a/services/convert/convert.go +++ b/services/convert/convert.go @@ -329,13 +329,9 @@ func ToActionWorkflowRun(ctx context.Context, run *actions_model.ActionRun, atte func loadPullRequestsForRun(ctx context.Context, run *actions_model.ActionRun) ([]*api.PullRequestMinimal, error) { result := []*api.PullRequestMinimal{} refName := git.RefName(run.Ref) - event := webhook_module.HookEventType(run.TriggerEvent) - if event == "" { - event = run.Event - } var prs issues_model.PullRequestList switch { - case event.IsPullRequest() || event.IsPullRequestReview(): + case run.Event.IsPullRequest() || run.Event.IsPullRequestReview(): index, err := strconv.ParseInt(refName.PullName(), 10, 64) if err != nil { return result, nil @@ -348,7 +344,7 @@ func loadPullRequestsForRun(ctx context.Context, run *actions_model.ActionRun) ( return nil, err } prs = issues_model.PullRequestList{pr} - case event == webhook_module.HookEventPush: + case run.Event == webhook_module.HookEventPush: branch := refName.BranchName() if branch == "" { return result, nil diff --git a/tests/integration/workflow_run_api_check_test.go b/tests/integration/workflow_run_api_check_test.go index cf427f964b..eb01bd1bb5 100644 --- a/tests/integration/workflow_run_api_check_test.go +++ b/tests/integration/workflow_run_api_check_test.go @@ -55,7 +55,7 @@ func testAPIWorkflowRunsPullRequestsField(t *testing.T) { Ref: "refs/pull/3/head", CommitSHA: "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef", Event: webhook_module.HookEventPullRequest, - TriggerEvent: string(webhook_module.HookEventPullRequest), + TriggerEvent: "pull_request_target", Status: actions_model.StatusSuccess, } require.NoError(t, db.Insert(ctx, run))