Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow a GHPullRequest to set auto-merge #2039

Open
roxspring opened this issue Feb 21, 2025 · 1 comment
Open

Allow a GHPullRequest to set auto-merge #2039

roxspring opened this issue Feb 21, 2025 · 1 comment

Comments

@roxspring
Copy link

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.

@bitwiseman
Copy link
Member

@roxspring
Interesting idea. If you have time to do this, PR welcome. Especially as something not exposed publicly or implemented in the internal namespace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants