Combining Reviewdog and GitHub CI With Ruff
Create a .reviewdog.ymlfile at the root of your project folder:
runner:
ruff:
name: "ruff"
cmd: "uvx ruff check --output-format=rdjson"
format: rdjson
This will makes possible to use reviewdog as a supported linter. Now using reviewdog ruff should give you an output in case of linting problem.
For the github integration, create a new github workflow, e.g. .github/workflows/reviewdog.yml
name: reviewdog
on:
push:
branches:
- master
pull_request:
jobs:
reviewdog-pr:
permissions:
checks: write
contents: read
pull-requests: write
if: github.event_name == 'pull_request'
name: reviewdog on Pull Request
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: reviewdog/action-setup@d8edfce3dd5e1ec6978745e801f9c50b5ef80252 # v1.4.0
with:
reviewdog_version: latest # Optional. [latest,nightly,v.X.Y.Z]
- name: Install uv
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
- name: Set up Python
run: uv python install && uv tool install ruff@latest
- name: Run reviewdog (github-pr-check)
continue-on-error: true
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
reviewdog -reporter=github-pr-check -runners=ruff -fail-on-error
This will only trigger on pull request. Now commit and push this file to have get reviewdog checks on your PR.