feat: add vacuum-lint action with documentation
All checks were successful
validate-shared-actions / validate-shared-actions (pull_request) Successful in 38s
Aikido Security PR Check / Aikido Security Scan (pull_request) Successful in 45s

This commit is contained in:
Maier David - J. Schmalz GmbH 2026-06-03 14:38:39 +00:00
parent 35b0a321bc
commit 3b44e99508
2 changed files with 90 additions and 0 deletions

25
vacuum-lint/README.md Normal file
View file

@ -0,0 +1,25 @@
# vacuum-lint
Action for validating and linting OpenAPI specifications using [Vacuum](https://github.com/daveshanley/vacuum).
## Inputs
| Input | Required | Default | Description |
|-------|----------|---------|-------------|
| `spec-dir` | No | `spec` | Directory containing the OpenAPI spec |
| `spec-filename` | No | `openapi.json` | Filename of the OpenAPI spec |
| `rules-filename` | No | `vacuum.rules.yaml` | Filename of the lint rules config file |
| `ignore-filename` | No | `vacuum.ignore.yaml` | Filename of the lint ignore file |
| `min-score` | No | `70` | Minimum linting score for the check to pass |
## Usage
```yaml
- uses: https://schmalz-git.git.onstackit.cloud/schmalz/shared-actions/vacuum-lint@vacuum-lint-v1
```
## Notes
- If `rules-filename` is found inside `spec-dir`, it is passed to Vacuum via `-r` to apply custom rulesets; otherwise Vacuum uses its default rules.
- If `ignore-filename` is found inside `spec-dir`, it is passed to Vacuum via `--ignore-file` to suppress known violations.
- The action fails when the computed linting score falls below `min-score`.

65
vacuum-lint/action.yml Normal file
View file

@ -0,0 +1,65 @@
name: Vacuum Lint
description: >
Validate and lint OpenAPI specifications using Vacuum.
inputs:
spec-dir:
description: Directory containing OpenAPI spec
required: false
default: "spec"
spec-filename:
description: Filename of the OpenAPI spec
required: false
default: "openapi.json"
rules-filename:
description: Filename of the lint rules config file
required: false
default: "vacuum.rules.yaml"
ignore-filename:
description: Filename of the lint ignore file
required: false
default: "vacuum.ignore.yaml"
min-score:
description: Minimum linting score for the check to pass
required: false
default: "70"
runs:
using: composite
steps:
# Pinned to commit SHA instead of a tag to prevent supply chain attacks.
- name: Install Vacuum
shell: bash
run: curl -fsSL https://raw.githubusercontent.com/daveshanley/vacuum/8222bba0c8b21a3a94faf472e06c4db06f06c6ce/bin/install.sh | sudo sh > /dev/null 2>&1
- name: Lint Spec
shell: bash
env:
SPEC_DIR: ${{ inputs.spec-dir }}
SPEC_FILE: ${{ inputs.spec-filename }}
RULES_FILE: ${{ inputs.rules-filename }}
IGNORE_FILE: ${{ inputs.ignore-filename }}
MIN_SCORE: ${{ inputs.min-score }}
run: |
echo "Linting: [$SPEC_DIR/$SPEC_FILE]"
# base command
CMD="vacuum lint $SPEC_DIR/$SPEC_FILE -x --min-score $MIN_SCORE"
# check for rules file
if [ -f "$SPEC_DIR/$RULES_FILE" ]; then
CMD="$CMD -r $SPEC_DIR/$RULES_FILE"
echo " - using ruleset [$SPEC_DIR/$RULES_FILE]"
fi
# check for ignore file
if [ -f "$SPEC_DIR/$IGNORE_FILE" ]; then
CMD="$CMD --ignore-file $SPEC_DIR/$IGNORE_FILE"
echo " - using ignore file [$SPEC_DIR/$IGNORE_FILE]"
fi
# execute command
$CMD
echo "Linted: [$SPEC_DIR/$SPEC_FILE]"
echo ""