How to sync GraphQL schema changes (from CI)

While Stellate offers caching functionality without knowing anything about your schema, some features rely on us knowing the structure of your GraphQL API. To automate schema updates and at the same time manage your Stellate service configuration as Configuration-as-Code, we recommend setting up your CI system to push changes to Stellate whenever you deploy to production.

  1. Pull your service's latest stellate.yml configuration file your service with the stellate pull command. Specify the --service argument set to your service's name, for example:

    npx stellate pull --service demo-app

    Commit your service's stellate.yml file to your repository. Also, make sure to regularly commit an up-to-date version of the configuration file to your repository if you make changes to your services configuration via the online dashboard.

  2. Create a Personal Access Token for your account at <>.

  3. Set the STELLATE_TOKEN environment variable in your CI service to the personal access token created in step 2.

  4. Add a task to your CI service for your desired branch, which runs npx stellate push. This command will push your GraphQL schema and configuration changes to Stellate.


Sync Schema Changes Only

If you want to only push schema changes instead of the entire configuration, modify the npx stellate push command in the following examples to read npx stellate push schema instead.

Provider Specific Instructions

Below are specific CI provider configurations. If your CI provider is not on this list contact us at [email protected], we'd be happy to help you configure it correctly!

GitHub Actions

To do this from GitHub Actions, add a file named .github/workflows/stellate.yml with the following contents and add the token you created as an encrypted secret to your repository.

name: Stellate
      - main 

    runs-on: ubuntu-latest
      - uses: actions/[email protected] 
      - uses: actions/[email protected] 
          node-version: '16.3.0'
          check-latest: true 
      - name: Push to Stellate
        run: npx stellate push 
          STELLATE_TOKEN: ${{ secrets.STELLATE_TOKEN }}

GitLab CI

For GitLab CI, add (or extend) your .gitlab-ci.yml configuration at the root of your repository.

You'll also need to configure your Stellate token as a masked and protected CI/CD variable. You'll find that section in your project settings, within the CI/CD settings page. See GitLab's documentation on Project Variables for more information.

  image: node:16.3.0
      - node_modules
    - if: '$CI_COMMIT_BRANCH =~ /^main/'
    - npx stellate push 

You might also want to update the rules section to your needs. The Gitlab documentation on rules has a good overview of how this works. Our example above pushes the configuration for each commit on the main branch.


Configure your Stellate token as an environment variable in a CircleCI Context and make sure that the jobs are configured to use that context.

      - image: cimg/node:16.3.0 
      - checkout 
      - run: npx stellate push 

      - stellate:
            - stellate