From c5063322741f7a8c9c4f94e53925d6254aa23386 Mon Sep 17 00:00:00 2001 From: Tobias Salzmann <796084+Eun@users.noreply.github.com> Date: Thu, 19 Oct 2023 10:53:41 +0200 Subject: [PATCH] chore: when merging always use the pull request title as commitHeadline (#34) --- pkg/merge-with-label/github/github.go | 12 ++++++++++-- pkg/merge-with-label/worker/pull_request_worker.go | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/pkg/merge-with-label/github/github.go b/pkg/merge-with-label/github/github.go index 0deb1e7..5dfbb40 100644 --- a/pkg/merge-with-label/github/github.go +++ b/pkg/merge-with-label/github/github.go @@ -292,14 +292,21 @@ func MergePullRequest( token, pullRequestID, expectedHeadOid, - mergeStrategy string, + mergeStrategy, + commitHeadline string, ) error { _, err := doGraphQLRequest(ctx, client, token, ` -mutation MergePulLRequest($pullRequestId: ID!, $expectedHeadOid: GitObjectID!, $mergeMethod: PullRequestMergeMethod!){ +mutation MergePulLRequest( + $pullRequestId: ID!, + $expectedHeadOid: GitObjectID!, + $mergeMethod: PullRequestMergeMethod!, + $commitHeadline: String! +){ mergePullRequest(input: { pullRequestId: $pullRequestId, expectedHeadOid: $expectedHeadOid, mergeMethod: $mergeMethod, + commitHeadline: $commitHeadline, }) { clientMutationId } @@ -308,6 +315,7 @@ mutation MergePulLRequest($pullRequestId: ID!, $expectedHeadOid: GitObjectID!, $ "pullRequestId": pullRequestID, "expectedHeadOid": expectedHeadOid, "mergeMethod": mergeStrategy, + "commitHeadline": commitHeadline, }) if err != nil { return errors.Wrap(err, "unable to merge pull request") diff --git a/pkg/merge-with-label/worker/pull_request_worker.go b/pkg/merge-with-label/worker/pull_request_worker.go index 2f60c35..d4e15e1 100644 --- a/pkg/merge-with-label/worker/pull_request_worker.go +++ b/pkg/merge-with-label/worker/pull_request_worker.go @@ -312,6 +312,7 @@ func (worker *pullRequestWorker) mergePullRequest( details.ID, details.LastCommitSha, cfg.Merge.Strategy.GithubString(), + details.Title, ); err != nil { var graphQLErrors github.GraphQLErrors if errors.As(err, &graphQLErrors) {