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 ""