src/graphql/data/, which are then consumed at render time by Next.js pages.
How the pipeline works
The sync script insrc/graphql/scripts/sync.ts performs an introspection query against GitHub’s GraphQL API for each supported version. It writes:
src/graphql/data/schema-VERSION.json— One schema file per version (e.g.,ghec,ghes-3.13)src/graphql/data/previews.json— Preview features available across versionssrc/graphql/data/upcoming-changes.json— Upcoming breaking changessrc/graphql/data/changelog.json— GraphQL API changelog entries
.github/workflows/sync-graphql.yml workflow runs on a schedule to keep these files current.
Directory structure
content/graphql/. Those files use Liquid to loop over the context data injected by the Next.js pages.
All files inside
src/graphql/data/ are generated. Edit lib/*.json and scripts/*.ts instead. Do not commit manual changes to data files.Running the sync locally
Run the sync script
src/graphql/data/.Schema validation
The project uses@graphql-inspector/core (a dev dependency) to validate GraphQL schema structure. The validator is configured in src/graphql/lib/validator.ts and runs as part of the test suite:
Editable configuration files
| File | Purpose |
|---|---|
lib/non-schema-scalars.json | Custom scalar types from graphql-ruby that are not in the GraphQL spec |
lib/types.json | High-level type taxonomy used in rendering |
lib/validator.ts | TypeScript validator used in tests/graphql.ts |
data/ — regenerate it with npm run sync-graphql.
How rendering works
GraphQL data is loaded in Next.js pages usinggetServerSideProps. The getGraphqlSchema() function from lib/index.ts provides:
- The schema for the requested version
- Preview features for that version
- Upcoming breaking changes
- The changelog
content/graphql/ use Liquid to loop over the context data and call HTML includes in the includes/ directory for rendering individual schema items.
Adding a new GHES version
When a new GHES version releases, you need to add a new schema file for it:Update content if needed
Check
content/graphql/ for any version-gated content that may need updates for the new version.Troubleshooting
Sync fails with an auth error
Sync fails with an auth error
Check that your
GITHUB_TOKEN is set in .env, has the correct scopes, and has SSO authorized for the github org.Schema not loading in the browser
Schema not loading in the browser
Verify that the file
src/graphql/data/VERSION/schema.json exists for the version being requested. Check that the version detection logic in lib/index.ts maps correctly to the file name.Content not rendering
Content not rendering
- Check Liquid syntax in the relevant
content/graphql/file. - Confirm the expected context properties (
context.graphql.*) are available. - Check the HTML includes in the
includes/directory.
Validation errors in tests
Validation errors in tests
Schema structure must match the JSON schema defined in
lib/validator.ts. If you see validation failures after a sync, compare the generated schema shape to what the validator expects and update validator.ts accordingly.Getting help
- Slack:
#docs-engineering - Repo:
github/docs-engineering