spectral-action icon indicating copy to clipboard operation
spectral-action copied to clipboard

Expose a parameter determining the minimum level that will trigger a build failure

Open nulltoken opened this issue 5 years ago • 2 comments

By default, spectral-action will fail the check when at least one error has been discovered. However, warnings for instance will generate annotations without failing the check.

Spectral exposes a flag that determine the minimum severity level that will trigger a failure.

Surfacing the parameter might be interesting to provide a better control to spectral-action users.

nulltoken avatar Apr 29 '20 17:04 nulltoken

This is much needed!

dahu33 avatar Sep 15 '21 06:09 dahu33

I'm also interested in this feature. As part of the CI action, I'd like Spectral to incorporate the --fail-severity=info option so that all output (other than "hint") will lead to some sort of discussion/fix in the PR. Are there any workarounds? Manually editing the style guide to set all "info" and "warning" level rules to "error" isn't a good option.

Edit: I ended up working around this by manually installing and running Spectral in my GitHub Actions workflow:

lint:
  name: Lint
  runs-on: ubuntu-latest
  steps:
    # Check out repository under $GITHUB_WORKSPACE
    - uses: actions/checkout@v3

    # Install Spectral
    - id: install_spectral
      run: npm install -g @stoplight/spectral-cli

    # Run Spectral
    - id: run_spectral
      run: spectral lint ./reference/*.{json,yml,yaml} --fail-severity=info

br-tyler-milner avatar Aug 09 '22 01:08 br-tyler-milner