forked from facebook/sapling
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix handling of GHE without merge queue support
Summary: facebook#830 and facebook#906 reported sapling not working for old Github Enterprise versions since their graphql schema doesnt include merge queue. This adds a query to detect if merge queue is supported in the graphql version. Then, it will issue a different "YourPullRequestsQuery" depending on if merge queue is supported. I considered a few other approaches: - Just detect the error message and retry without merge queue field - a little gross to extract from the error - Use "@include" instead of an entirely separate query - didn't seem to count as a valid query still via graphiql at least (unsure if the query client here would strip out the unused field though) Test Plan: Haven't had a chance to test yet, will try and validate that both versions work and that the detection logic works.
- Loading branch information
1 parent
5f7a862
commit 986844b
Showing
4 changed files
with
234 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
addons/isl-server/src/github/queries/MergeQueueSupportQuery.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
query MergeQueueSupportQuery { | ||
__type(name: "MergeQueueEntry") { | ||
__typename | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
addons/isl-server/src/github/queries/YourPullRequestsWithoutMergeQueueQuery.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
query YourPullRequestsWithoutMergeQueueQuery($searchQuery: String!, $numToFetch: Int!) { | ||
search(query: $searchQuery, type: ISSUE, first: $numToFetch) { | ||
nodes { | ||
... on PullRequest { | ||
__typename | ||
number | ||
title | ||
body | ||
state | ||
isDraft | ||
url | ||
reviewDecision | ||
comments { | ||
totalCount | ||
} | ||
commits(last: 1) { | ||
nodes { | ||
commit { | ||
statusCheckRollup { | ||
state | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |