diff --git a/internal/forge/gitlab/gitlab.go b/internal/forge/gitlab/gitlab.go index f77b324..aedc4f3 100644 --- a/internal/forge/gitlab/gitlab.go +++ b/internal/forge/gitlab/gitlab.go @@ -176,8 +176,8 @@ func (g *GitLab) prForCommit(ctx context.Context, commit git.Commit) (*git.PullR var mergeRequest *gitlab.MergeRequest for _, mr := range associatedMRs { - // We only look for the MR that has this commit set as the "merge commit" => The result of squashing this branch onto main - if mr.MergeCommitSHA == commit.Hash { + // We only look for the MR that has this commit set as the "merge/squash commit" => The result of squashing this branch onto main + if mr.MergeCommitSHA == commit.Hash || mr.SquashCommitSHA == commit.Hash { mergeRequest = mr break } @@ -387,9 +387,12 @@ func gitlabMRToReleasePullRequest(pr *gitlab.MergeRequest) *releasepr.ReleasePul } } + // Commit SHA is saved in either [MergeCommitSHA] or [SquashCommitSHA] depending on which merge method was used. var releaseCommit *git.Commit if pr.MergeCommitSHA != "" { releaseCommit = &git.Commit{Hash: pr.MergeCommitSHA} + } else if pr.SquashCommitSHA != "" { + releaseCommit = &git.Commit{Hash: pr.SquashCommitSHA} } return &releasepr.ReleasePullRequest{