-
Notifications
You must be signed in to change notification settings - Fork 285
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 (#926)
Summary: Fix handling of GHE without merge queue support #830 and #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) Pull Request resolved: #926 Test Plan: Haven't had a chance to test yet, will try and validate that both versions work and that the detection logic works. Reviewed By: evangrayk Differential Revision: D60215245 fbshipit-source-id: cb36a77fbe0665353740d7fa97bc21ee9c86e0e8
- Loading branch information
1 parent
1fa5657
commit 4aa5697
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 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |