-
Hi a short question how would you undraft a pull request? Tried with GHPullRequest.requestTeamReviewers but didn't work |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 10 replies
-
Unfortunately, there's nothing you can do with the REST API, GitHub doesn't expose an endpoint for that (at least to my knowledge, I did another check and couldn't find something about it). So what you need to do is use the GraphQL API which exposes a mutation for it: https://docs.github.com/en/graphql/reference/mutations#markpullrequestreadyforreview . Some operations are only available in the REST API and some others are only available in the GraphQL API. That's a bit unfortunate but that's how it is. I think I remember you asking questions in Quarkus GitHub App so if you are still using it, something like this should probably work (not tested):
You have a full example here of how to use GraphQL in Quarkus GitHub App given Discussions are only exposed as GraphQL: https://github.com/quarkusio/quarkus-github-bot/blob/main/src/main/java/io/quarkus/bot/TriageDiscussion.java . HTH. |
Beta Was this translation helpful? Give feedback.
-
Almost work like that, GraphQLResponse{
data={"markPullRequestReadyForReview":null},
errors=[
Error{
message=Resource not accessible by integration,
locations=[{line=2, column=3}],
path=[markPullRequestReadyForReview],
extensions={saml_failure=false},
otherFields={type=FORBIDDEN}}
]
} Code in Use: graphql.executeAsync("""
mutation MarkPullRequestReadyForReview($pullRequestId: ID!) {
markPullRequestReadyForReview(input: {
pullRequestId: $pullRequestId
}) {
clientMutationId
}
}
""", Map.of("pullRequestId", pullRequest.getNodeId()))
.subscribe().with(
response -> log.info("Undraft successfully: {}", response),
throwable -> log.error("Can't undraft PR", throwable)
); The App has PR Read/Write, Issue Read/Write, Contents Read/Write access. |
Beta Was this translation helpful? Give feedback.
Unfortunately, there's nothing you can do with the REST API, GitHub doesn't expose an endpoint for that (at least to my knowledge, I did another check and couldn't find something about it).
So what you need to do is use the GraphQL API which exposes a mutation for it: https://docs.github.com/en/graphql/reference/mutations#markpullrequestreadyforreview .
Some operations are only available in the REST API and some others are only available in the GraphQL API. That's a bit unfortunate but that's how it is.
I think I remember you asking questions in Quarkus GitHub App so if you are still using it, something like this should probably work (not tested):