Skip to content

Commit

Permalink
fixup! feat: custom rulesets
Browse files Browse the repository at this point in the history
  • Loading branch information
nulltoken committed Apr 25, 2020
1 parent fa597ca commit 432d0f9
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/spectral.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ jobs:
name: Spectral checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v2
- name: Spectral checks
uses: ./
with:
file_glob: ./**/*.yml
repo_token: ${{ secrets.GITHUB_TOKEN }}
spectral_ruleset: 'spectral:oas'
spectral_ruleset: .spectral.yml
1 change: 1 addition & 0 deletions .spectral.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extends: spectral:oas
21 changes: 15 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ This action uses [Spectral](https://github.com/stoplightio/spectral) from [Stopl

![](./image.png)

## Install
## Usage

```json
See [action.yml](action.yml)

```yaml
name: Run Spectral on Pull Requests

on:
Expand All @@ -17,16 +19,23 @@ jobs:
name: Run Spectral
runs-on: ubuntu-latest
steps:

# Check out the repository
- uses: actions/checkout@v1
- uses: actions/checkout@v2

# Run Spectral
- uses: stoplightio/[email protected]
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file_glob: doc/api/*.yaml
spectral_ruleset: 'spectral:oas'
```
## Configuration
### Inputs
Spectral Action will respect your [Spectral Rulesets](https://stoplight.io/p/docs/gh/stoplightio/spectral/docs/getting-started/rulesets.md), which can be defined, extended, and overriden by placing `.spectral.yml` in the root of your repository.
- **repo_token:** _[Required]_ GitHub token to access the repository containing the files to lint
- **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:** Ruleset to load in Spectral. Defaults to `spectral:oas`

## Configuration

Spectral Action will respect your [Spectral Rulesets](https://stoplight.io/p/docs/gh/stoplightio/spectral/docs/getting-started/rulesets.md), which can be defined, extended, and overriden by placing `.spectral.yml` in the root of your repository.
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ inputs:
default: 'spectral:oas'
repo_token:
required: true
description: Ruleset file to load in Spectral
description: GitHub token to access the repository containing the files to lint
runs:
using: docker
image: Dockerfile
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@actions/core": "^1.2.3",
"@actions/github": "^2.1.1",
"@stoplight/json": "^3.5.1",
"@stoplight/spectral": "^5.1.0",
"@stoplight/spectral": "^5.3.0",
"fast-glob": "^3.2.2",
"fp-ts": "^2.5.3",
"io-ts": "^2.1.2",
Expand Down

0 comments on commit 432d0f9

Please sign in to comment.