Skip to content

A GitHub Action to run schema checks

Notifications You must be signed in to change notification settings

grafbase/schema-check-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 

Repository files navigation

Grafbase Schema Check Action

This is a GitHub Action to run schema checks on your GraphQL subgraphs and standalone graphs before publishing them.

Using it can look like this:

- uses: grafbase/schema-check-action@v1
  with:
    grafbase-access-token: ${{ secrets.GRAFBASE_ACCESS_TOKEN }}
    project-ref: tomhoule/grafbase-single-graph-ci-example@main
    schema-path: ./sdl.graphql
    subgraph-name: products

Inputs

  • grafbase-access-token (required): an access token generated on the Grafbase dashboard.

  • project-ref (required): the project and (optional) branch of the graph to check.

  • schema-path (required): the file system path to the schema to check (as GraphQL SDL).

    Tip: the easiest way to produce the GraphQL schema for your graph is grafbase introspect --dev > api.graphql. You can run that command in a workflow step before the action, and pass schema-path: api.graphql to this action.

  • subgraph-name: the name of the subgraph to check, in a federated project. This should not be provided if the project is a single graph.

  • slack-incoming-webhook-url (optional): a Slack Incoming Webhook url that will be called with the errors whenever checks fail. See the official tutorial on how to set up an app and a webhook URL.

Behavior

There are no outputs. The step will fail with the schema check errors if there are any.

Workflow

In general, a schema check fits in your deployment workflow in any place where you publish a (sub)graph: you run a check before publishing to make sure that the schema can be safely published.

For example, if your schema is published on merge to main, you would run the check against myaccount/myproject@main on pull requests to main.

Example repositories