Spectral for GitHub

Integrating with Github Actions is as simple as downloading Spectral and running a scan in your test or build scripts.

First, grab your DSN from the SpectralOps platform and set up your SPECTRAL_DSN in the CI environment variables as a secret. See more here.

Here's an example GitHub Action with Spectral:

.github/workflows/scan.yml
name: Main
on: [push]
env:
SPECTRAL_DSN: ${{ secrets.SPECTRAL_DSN }}
jobs:
build:
name: Spectral
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Install
run: curl -L "https://get.spectralops.io/latest/x/sh?dsn=$SPECTRAL_DSN" | sh
- name: Scan
run: $HOME/.spectral/spectral scan
tip

We cryptographically sign our binaries. However, you might prefer downloading the Spectral binary and storing it in your own artifact store periodically, then, you can pull from your own store in your CI workflows.

With Spectral integrated, your builds should now look like this:

tip

Use spectral scan --ok if you wouldn't like to break builds. It's common to use this mode when you're ramping up your discovery of issues, or when you have a different kind of security workflow.