Skip to content

Allow a GHPullRequest to set auto-merge #2039

@roxspring

Description

@roxspring

I've been using the API to generate PRs for our main repository in a similar vein to dependabot, and would really like to be able to set those to auto-merge (which has been allowed in our repository):

ghPullRequest.requestAutoMerge();

Clearly this isn't supported by the Java API, presumably because it's not supported by the GitHub REST API either. However it is supported by via a couple (oh, the irony!) of GraphQL API queries:

query GetPullRequestID {
  repository(name: "$repo", owner: "$owner") {
    pullRequest(number: "$prnum") {
      id
    }
  }
}
mutation EnableAutoMergeOnPullRequest {
  enablePullRequestAutoMerge(input: {pullRequestId: "$pullRequestID", mergeMethod: MERGE}) {
    clientMutationId
  }
}

Rather than boiling the ocean by requesting general purpose public GraphQL support (#521), I wonder whether it might be acceptable to implement some low level GraphQL support that could be used internally to implement specific features not available in the REST API, such as enabling auto-merge on a PR. Perhaps in time this could become the basis for some general support but the immediate goal would be to enable access to APIs.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions