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
1
Ensure API access
You need a GitHub token with access to the GraphQL API. Set it in your
.env:2
Run the sync script
src/graphql/data/.3
Verify the output
Check that the schema files were updated. The
data/ghec/schema.json file should reflect the latest introspection result.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
Do not manually edit any file inside
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:1
Update the version list
Add the new version to the version list in
src/graphql/scripts/sync.ts.2
Run the sync
data/ghes-X.XX/schema.json file is created.3
Update content if needed
Check
content/graphql/ for any version-gated content that may need updates for the new version.4
Commit the generated file
Commit the new schema file. It is large (100 KB+) but must be committed because the site reads it at runtime.
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