Skip to content

Commit

Permalink
AutoMerge Pull Request (#6)
Browse files Browse the repository at this point in the history
AutoMerge Pull Request  enabled
  • Loading branch information
louisfischer authored Jan 7, 2024
1 parent 06b860e commit 7d90f30
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/Cake.GitHub.Endpoints/GitHubEndpointsPullRequestAliases.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,16 @@ public static async Task<PullRequest> GitHubPullRequestAutoMerge(this IGitHubEnd
await context.HttpPostAsync(GraphQL.ApiUrl, settings =>
{
settings.UseBearerAuthorization(context.GitHubToken)
.SetRequestBody($"mutation PullRequestAutoMerge {{ enablePullRequestAutoMerge(input: {{pullRequestId: \"{pr.NodeId}\", mergeMethod: {mergeMethod.ToString().ToUpperInvariant()}}}) {{ clientMutationId }}}}")
.SetContentType("application/json");
.SetJsonRequestBody(new
{
query = @"mutation PullRequestAutoMerge($pullRequestId: ID!, $mergeMethod: PullRequestMergeMethod) { enablePullRequestAutoMerge(input: { pullRequestId: $pullRequestId, mergeMethod: $mergeMethod }) { actor { login } clientMutationId pullRequest { id } }}",
variables = new { pullRequestId = pr.NodeId, mergeMethod = mergeMethod.ToString().ToUpperInvariant() }
});
});

return pr;
return await GitHubPullRequest(context, number);
}

//=> context.GitHubClient().PullRequest.Merge(context.Owner, context.RepoName, number, new MergePullRequest { MergeMethod = PullRequestMergeMethod.Squash, CommitTitle = title, CommitMessage = message });

/// <summary>
/// Get the pull request merge status.
/// </summary>
Expand Down

0 comments on commit 7d90f30

Please sign in to comment.