Skip to main content

GitHub Actions

Basic workflow

name: Code Quality
on:
  pull_request:

jobs:
  vipr:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '22'
          cache: 'npm'
      - name: Run Vipr
        run: |
          npx --yes @vipr/cli analyze "src/**/*.{ts,tsx}" \
            --format json \
            --output vipr-report.json \
            --fail-threshold 70 \
            --fail-on-critical \
            --quiet
      - uses: actions/upload-artifact@v4
        if: always()
        with:
          name: vipr-report
          path: vipr-report.json

Adding PR comments

Use the Markdown output format to post results as a PR comment:

- name: Run analysis
  run: |
    npx --yes @vipr/cli analyze "src/**/*.{ts,tsx}" \
      --format markdown \
      --output vipr-comment.md \
      --quiet

- name: Comment on PR
  uses: peter-evans/create-or-update-comment@v4
  with:
    issue-number: ${{ github.event.pull_request.number }}
    body-path: vipr-comment.md

Changed-files workflows

If your pull request workflow already knows the base ref, you can narrow analysis to changed files:

vipr analyze "src/**/*.{ts,tsx}" --changed origin/main

That is useful for fast feedback, but it should complement rather than replace a full baseline job.

Documentation