From 4dd7d61ac8c8bff81a0f9e376032f45eb12f51a9 Mon Sep 17 00:00:00 2001 From: John Olheiser Date: Wed, 8 Feb 2023 20:47:52 -0600 Subject: [PATCH] Load issue before accessing index in merge message (#22822) Fixes #22821 Signed-off-by: jolheiser --- services/pull/merge.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/services/pull/merge.go b/services/pull/merge.go index edd5b601d..a3d69df8d 100644 --- a/services/pull/merge.go +++ b/services/pull/merge.go @@ -98,6 +98,9 @@ func GetDefaultMergeMessage(ctx context.Context, baseGitRepo *git.Repository, pr } for _, ref := range refs { if ref.RefAction == references.XRefActionCloses { + if err := ref.LoadIssue(ctx); err != nil { + return "", "", err + } closeIssueIndexes = append(closeIssueIndexes, fmt.Sprintf("%s %s%d", closeWord, issueReference, ref.Issue.Index)) } }