Use vacuum in your GitHub CI/CD pipeline.
The official vacuum
GitHub action is available in the Github Action Marketplace.
You can also find the source here.
Add vacuum as a workflow step
Add the action to your repo via a workflow via pb33f/vacuum-action@v2
Configurable properties you can use in your workflow:
Property | Type | Required | Description |
---|---|---|---|
openapi_path |
string |
true | The path to your OpenAPI spec file, relative to the root of your repository. |
github_token |
string |
true | The GitHub token to use for authentication. This is required to post comments on pull requests. |
ruleset |
string |
false | The path to a custom ruleset file, relative to the root of your repository. If not provided, the default ruleset will be used. |
show_rules |
boolean |
false | If set to true , the action will show the rules that were applied. Defaults to false |
fail_on_error |
boolean |
false | If set to true , the action will fail if any errors are detected in the OpenAPI spec. Defaults to true |
minimum_score |
number |
false | The minimum score required to not fail the check. Defaults to 70 . |
print_logs |
boolean |
false | If set to true , the action will print the markdown report to the runner logs. Defaults to true |
Example Workflow
name: "Lint OpenAPI spec with vacuum"
on:
pull_request: {}
permissions:
contents: read
pull-requests: write
jobs:
vacuum-lint:
name: Run OpenAPI linting with vacuum
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Run OpenAPI lint with vacuum
uses: pb33f/vacuum-action@v2
with:
openapi_path: "specs/openapi.yaml"
github_token: ${{ secrets.GITHUB_TOKEN }}
Example Workflow with optional parameters
name: "Lint OpenAPI spec with vacuum"
on:
pull_request: {}
permissions:
contents: read
pull-requests: write
jobs:
vacuum-lint:
name: Run OpenAPI linting with vacuum
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Run OpenAPI lint with vacuum
uses: pb33f/vacuum-action@v2
with:
openapi_path: "specs/openapi.yaml"
ruleset: "rulesets/vacuum-ruleset.yaml"
show_rules: true
fail_on_error: true
minimum_score: 90
print_logs: true
github_token: ${{ secrets.GITHUB_TOKEN }}