https://github.com/stoplightio/spectral-action
GitHub Action wrapper for Spectral - a JSON/YAML/OpenAPI/AsyncAPI/etc linter with custom rule support.
https://github.com/stoplightio/spectral-action
Last synced: about 1 year ago
JSON representation
GitHub Action wrapper for Spectral - a JSON/YAML/OpenAPI/AsyncAPI/etc linter with custom rule support.
- Host: GitHub
- URL: https://github.com/stoplightio/spectral-action
- Owner: stoplightio
- License: apache-2.0
- Created: 2019-02-16T10:27:47.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-11-18T22:46:06.000Z (over 1 year ago)
- Last Synced: 2025-05-11T18:48:13.019Z (about 1 year ago)
- Language: JavaScript
- Homepage: https://stoplight.io/open-source/spectral
- Size: 1.52 MB
- Stars: 95
- Watchers: 16
- Forks: 46
- Open Issues: 23
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Spectral Linter Action
This action uses [Spectral](https://github.com/stoplightio/spectral) from [Stoplight](https://stoplight.io/) to lint your OpenAPI documents, or any other JSON/YAML files.

## Usage
See [action.yml](action.yml)
```yaml
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@v3
# Run Spectral
- uses: stoplightio/spectral-action@latest
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](https://www.npmjs.com/package/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.
## Configuration
Spectral Action will respect your [Spectral Rulesets](https://meta.stoplight.io/docs/spectral/01baf06bdd05a-rulesets), which can be defined, extended, and overriden by placing `.spectral.yml` in the root of your repository.
However, if you'd like to simply use a core ruleset without additional configuration, create a `.spectral.yml` in you repository's root with only the contents: `extends: ["spectral:{rulesetTagHere}"]`