Repository navigation
fix: use GITHUB_GRAPHQL_URL for GraphQL requests - #143
Merged
Merged
Conversation
GHES serves the REST API at `<host>/api/v3` and GraphQL at `<host>/api/graphql`. Joining `/graphql` onto the REST API URL replaced the whole path, so review queries and mutations were sent to `<host>/graphql` and failed. Derive the GraphQL endpoint once from the API URL instead.
2bndy5
requested changes
Oct 20, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #143 +/- ##
==========================================
- Coverage 96.94% 96.90% -0.05%
==========================================
Files 16 16
Lines 1769 1778 +9
==========================================
+ Hits 1715 1723 +8
- Misses 54 55 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
GitHub runners set GITHUB_GRAPHQL_URL (https://api.github.com/graphql on github.com, <host>/api/graphql on GHES), so use it instead of deriving the URL from GITHUB_API_URL. Falls back to https://api.github.com/graphql, like GITHUB_API_URL does.
2bndy5
approved these changes
Oct 20, 2026
2bndy5
left a comment
Owner
There was a problem hiding this comment.
So much cleaner with GITHUB_GRAPHQL_URL env var.
1 of 9 tasks
This branch was successfully deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #140.
Before: GraphQL requests used
api_url.join("/graphql"). The leading/replaces the whole path, so on GitHub Enterprise Server, where the REST API is athttps://<host>/api/v3and GraphQL is athttps://<host>/api/graphql, every GraphQL request (fetching existing review threads, resolving or deleting old review comments, hiding outdated reviews) went tohttps://<host>/graphqland failed.After: the client reads the GraphQL endpoint from
GITHUB_GRAPHQL_URL, which GitHub runners set on both github.com (https://api.github.com/graphql) and GHES (https://<host>/api/graphql). When it is not set, it falls back tohttps://api.github.com/graphql, the same wayGITHUB_API_URLfalls back tohttps://api.github.com.https://api.github.com/graphqlhttps://api.github.com/graphql(unchanged)https://<host>/graphqlhttps://<host>/api/graphqlHow:
GithubApiClientstores the parsedGITHUB_GRAPHQL_URLin agraphql_urlfield, used by all three GraphQL calls ingraphql.rs. The unit testensure_api_url_has_trailing_slashchecks the field, andtests/github_pr_reviews.rspointsGITHUB_GRAPHQL_URLat the mock server.Found while testing cpp-linter-action with cpp-linter 1.15.0 (cpp-linter/cpp-linter-action#501).
Summary by CodeRabbit