0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-05-12 11:13:21 +02:00

fix PR association

This commit is contained in:
Nicolas 2026-05-08 22:43:33 +02:00
parent 06f8698534
commit 082b95fc8b
2 changed files with 3 additions and 7 deletions

View File

@ -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

View File

@ -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))