Skip to content

Instantly share code, notes, and snippets.

@LouManglass
Created March 1, 2021 14:55
Show Gist options
  • Save LouManglass/3470d8dec90faf35363caa68ec36bcf6 to your computer and use it in GitHub Desktop.
Save LouManglass/3470d8dec90faf35363caa68ec36bcf6 to your computer and use it in GitHub Desktop.
Checks specification by running tests with --exit-on-diff flag
name: Optic CI
on:
pull_request:
workflow_dispatch:
jobs:
check-spec:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
- name: Install Optic
run: npm install @useoptic/cli
- name: Run tests
run: |
npx api run run-diff-tests --exit-on-diff
- uses: actions/github-script@v3
if: ${{failure()}}
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Optic detected differences in behavior. Please re-run your tests locally and check your specification with `api status`.'
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment