Documentation
Products
GitHub Action

GitHub Action

GraphQL Inspector Action is a GitHub Action that you can install in any of your repositories.

GraphQL Inspector Action checks your Pull Request to find breaking changes (and others) in a GraphQL Schema, against your master branch.

Application

Usage

name: CI
 
on: [push]
 
jobs:
  test:
    name: Check Schema
    runs-on: ubuntu-latest
 
    steps:
      - name: Checkout
        uses: actions/checkout@master
 
      - uses: kamilkisiela/graphql-inspector@master
        with:
          schema: 'master:schema.graphql'

Now on every commit or every Pull Request, the GraphQL Inspector App will annotate every change, next to the line in the code where it happened.

Checks permission needs to be set to write access while running GitHub action.

Inputs

name

The name of the check (GraphQL Inspector by default).

In case of multiple GraphQL Inspector Actions, use name to prevent GitHub from overwriting results. For example, “Check Public API” and “Check Internal API”.

- uses: kamilkisiela/graphql-inspector@master
  with:
    name: Validate Public API
    schema: 'master:public.graphql'
 
- uses: kamilkisiela/graphql-inspector@master
  with:
    name: Check Internal API
    schema: 'master:internal.graphql'

annotations

Use annotation (true by default).

- uses: kamilkisiela/graphql-inspector@master
  with:
    schema: 'master:schema.graphql'
    annotations: false

fail-on-breaking

Fail on breaking changes (true by default).

- uses: kamilkisiela/graphql-inspector@master
  with:
    schema: 'master:schema.graphql'
    fail-on-breaking: false

approve-label

Label to mark Pull Request introducing breaking changes as safe and expected By default, GraphQL Inspector fails the Pull Request when it detects any breaking changes (approved-breaking-change by default).

- uses: kamilkisiela/graphql-inspector@master
  with:
    schema: 'master:schema.graphql'
    approve-label: expected-breaking-change

To mark the breaking change as safe, apply the approved-breaking-change label or define your own in approve-label.

endpoint

Use GraphQL API endpoint as a source of schema. It should represent the “before” schema.

- uses: kamilkisiela/graphql-inspector@master
  with:
    schema: schema.graphql # important to define a path to schema file, without a branch
    endpoint: 'https://my-app.com/graphql'

If you want to use GraphQL API endpoint as source of “after” schema:

- uses: kamilkisiela/graphql-inspector@master
  with:
    schema: 'https://pr-1234.my-app.dev/graphql'
    endpoint: 'https://my-app.com/graphql'

rules

Apply rules included with the Inspector as well as your own custom rules

- uses: kamilkisiela/graphql-inspector@master
  with:
    schema: 'master:schema.graphql'
    rules: |
      suppressRemovalOfDeprecatedField
      custom-rule.js

onUsage

Must be used with the rules input. Required to apply the custom logic for the considerUsage rule

- uses: kamilkisiela/graphql-inspector@master
  with:
    schema: 'master:schema.graphql'
    rules: |
      considerUsage
    onUsage: check-usage.js

Outputs

Read GitHub Actions docs to see how to use outputs.

changes

Total number of changes

Summary

Annotations