Skip to content

CLI in CI

Abdulkader Safi edited this page Nov 23, 2026 · 2 revisions

CLI in CI

Exit codes

Code Meaning
0 The audit ran and passed every threshold
1 --fail-under or --fail-on tripped
2 The audit could not run: bad URL, start page unreachable, bad config, missing browser

CI runs never check for updates or prompt: the check only runs when stdin and stderr are a terminal.

Thresholds

# Fail when the overall score drops below 85
sitevet audit https://staging.example.com --fail-under 85 --out report.html

# Fail on any failing error-severity finding
sitevet audit https://staging.example.com --fail-on error

# Fail on failing or warning findings of error or warning severity
sitevet audit https://staging.example.com --fail-on warning

Both can be set in sitevet.toml under [cli], so the CI command stays short.

GitHub Actions

name: site audit
on: [push]
jobs:
  audit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Install sitevet
        run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/Abdulkader-Safi/sitevet/releases/latest/download/sitevet-cli-installer.sh | sh
      - name: Audit
        run: sitevet audit https://staging.example.com --max-pages 50 --fail-under 85 --no-save --out report.html
      - uses: actions/upload-artifact@v4
        if: always()
        with:
          name: sitevet-report
          path: report.html

--no-save keeps the runner from writing a history database it throws away. if: always() uploads the report even when the score fails the build, which is when you want to read it.

For rendered checks in CI, ubuntu-latest runners already have Chrome, so --browser works there. Or set a SITEVET_PSI_KEY secret and pass it as an environment variable.

JSON for other tools

sitevet audit https://example.com --format json --no-save > report.json
jq '.score, (.categories[] | {category, score})' report.json

stdout holds only the report, so it pipes cleanly. Progress and errors go to stderr.

Clone this wiki locally