GithubHelp home page GithubHelp logo

comp615 / apollo-schema-check-action Goto Github PK

View Code? Open in Web Editor NEW

This project forked from iansu/apollo-schema-check-action

0.0 0.0 0.0 34.96 MB

A GitHub Action to run a schema check with Apollo Studio and post the results as a comment on a Pull Request

License: MIT License

Shell 0.22% JavaScript 3.09% TypeScript 96.69%

apollo-schema-check-action's Introduction

Apollo Schema Check Action

Build status codecov

A GitHub Action to run a schema check using the Apollo CLI and Apollo Studio (formerly Graph Manager) and post the results as a comment on a Pull Request

Usage

Create a file in your repo named .github/workflows/schema-check.yml with the following contents:

name: Schema Check

on:
  pull_request:
    types: [opened, reopened, synchronize]

jobs:
  check_schema:
    name: check schema
    runs-on: ubuntu-latest
    timeout-minutes: 5
    steps:
      - uses: actions/checkout@v2
      - name: Customer API check
        uses: iansu/apollo-schema-check-action@v2
        with:
          title: Customer API
          graph: my-customer-api
          variant: production
          localSchemaFile: 'schema.graphql'
          serviceName: my-service
          validationPeriod: P2W
          key: ${{ secrets.APOLLO_KEY }}
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

When you create a new PR that includes schema changes the results of the schema check will be posted as a comment. Here's an example of what that looks like:

Screenshot

Note that you won't see a comment if your PR doesn't include any schema changes. You can change this behaviour by setting alwaysComment: true.

Settings

If you provide the path to an Apollo config file in your project any applicable settings from there will be used. If a setting is specified in the Apollo config file and in the workflow settings, the workflow setting will take precedence.

You must provide either an endpoint to introspect your schema or the path to one or more localSchemaFiles.

Name Description Default Required
alwaysComment Leave a comment on the PR even if there are no schema changes in the PR false No
config Path to your Apollo config file No
endpoint The URL for the CLI to use to introspect your service No
failOnError Fail the check if breaking changes or composition errors are found true No
graph The ID of the graph in Apollo Graph Manager to check your proposed schema changes against No
headers Additional headers to send to server for introspectionQuery. Multiple headers can be provided as a comma separated list. NOTE: The endpoint input is REQUIRED if using the headers input. No
key The API key to use for authentication to Apollo Graph Manager Yes
localSchemaFile Path to one or more local GraphQL SDL file(s). Supports comma-separated list of paths (ex. schema.graphql,extensions.graphql) No
queryCountThreshold Minimum number of requests within the requested time window for a query to be considered No
queryCountThresholdPercentage Number of requests within the requested time window for a query to be considered, relative to total request count. Expected values are between 0 and 0.05 (minimum 5% of total request volume) No
serviceName Provides the name of the implementing service for a federated graph. This flag will indicate that the schema is a partial schema from a federated service No
title The name of the graph which will be shown in the comment No
validationPeriod The size of the time window with which to validate the schema against. You may provide a number (in seconds), or an ISO8601 format duration for more granularity (see: ISO 8601 Durations Yes
variant The variant to check the proposed schema against No

Why use this instead of the Apollo GitHub App

This Action offers some features that the Apollo GitHub App doesn't. If you don't need these features then you should consider using it instead. The main differences are:

  1. You don't have to install an app in your org or repo to use this Action
  2. This Action posts a comment with the results directly on your PR
  3. This Action supports multiple graphs

Credits

Made with ๐Ÿฅƒ by Ian Sutherland (@iansu). This project is released under the MIT license.

apollo-schema-check-action's People

Contributors

andresrodh avatar comp615 avatar dependabot[bot] avatar iansu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.