Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
check-square

GitHub Action

Spectral Linting

v0.8.2

Spectral Linting

check-square

Spectral Linting

Lint your files with Spectral

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Spectral Linting

uses: stoplightio/[email protected]

Learn more about this action in stoplightio/spectral-action

Choose a version

Spectral Linter Action

This action uses Spectral from Stoplight to lint your OpenAPI documents, or any other JSON/YAML files.

Usage

See action.yml

name: Run Spectral on Pull Requests

on:
  - pull_request

jobs:
  build:
    name: Run Spectral
    runs-on: ubuntu-latest
    steps:
      # Check out the repository
      - uses: actions/checkout@v2

      # Run Spectral
      - uses: stoplightio/[email protected]
        with:
          file_glob: 'doc/api/*.yaml'

Inputs

  • file_glob: Pattern describing the set of files to lint. Defaults to *.oas.{json,yml,yaml}. (Note: Pattern syntax is documented in the fast-glob package documentation)
  • spectral_ruleset: Custom ruleset to load in Spectral. When unspecified, will try to load the default .spectral.yaml ruleset if it exists; otherwise, the default built-in Spectral rulesets will be loaded.

Configuration

Spectral Action will respect your Spectral Rulesets, which can be defined, extended, and overriden by placing .spectral.yml in the root of your repository.