Reviewdog filter settings with GitHub Actions

Reviewdog is a tool to use with GitHub actions for applying review tools in your CI. I use it with Vale, and it’s really good. One thing that has tripped me up multiple times is that by default, it only applies the checks to the changes in the pull request, not to the whole project. So when you add something like Vale, which is a prose linter, it only checks … the workflow file you just added! I always forget that it works this way, and how to change it, so I’m pasting some examples for future reference.

Apply checks to all files

In general, I don’t find it helpful to have the review tools reporting errors across a whole project on every build. However when I do want to see GitHub actions running the checks for the whole project, I can never remember the setting. So, future self, note that it is nofilter (the problem is not the option name, it’s just that I don’t remember things).

At the moment I’m working on a pull request where I’m adding Vale to GitHub actions via Reviewdog. The pull request only changes the workflow file, the Vale config, and the styles/Vocab files that go with Vale, so by default the build goes green and no problems are reported with the existing contents of the docs/ folder. I am pretty sure we didn’t write perfect content when we didn’t have any tools in place!! In fact if you check the build output, it does find problems in the project, but since they weren’t introduced in this pull request, they don’t match the filter. You can see the problems listed, but then not reported.

The nofilter setting removes the filter and those errors and warnings get reported to the build. The job configuration looks like this:

  vale:
    name: vale action
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: errata-ai/vale-action@reviewdog
        with:
          files: '["README.md", "docs"]'
          filter_mode: nofilter
          fail_on_error: true

Once I’m satisfied that we’ve introduced the necessary fixes as well as the tool that checks them, I’ll switch this back to file before the pull request merges.

Apply checks to changed files

My preferred filter setting for day-to-day use is file. In this mode, the checks run across the whole file for any file that has changed. It works well for something like a prose linter because it means that if something needs updating, we update it everywhere in the file, all at once, while we’re changing that file anyway.

Here’s the job configuration again:

  vale:
    name: vale action
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: errata-ai/vale-action@reviewdog
        with:
          files: '["README.md", "docs"]'
          filter_mode: file
          fail_on_error: true

It can be frustrating if you’re changing something tiny and you get a whole file full of annotations – but in general, this approach has worked pretty well for me every time I’ve remembered what the setting is called! I’d be interested to hear how others manage this sort of thing and if you have any tips to share.


Also published on Medium.

One thought on “Reviewdog filter settings with GitHub Actions

Leave a Reply

Please use [code] and [/code] around any source code you wish to share.

This site uses Akismet to reduce spam. Learn how your comment data is processed.