Reviewdog filter settings with GitHub Actions
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.
Not personally used it, but Vale is well recommended with technical writers I know (but may require some configuring), ie https://lornajane.net/posts/2024/reviewdog-filter-settings-with-github-actions from @lornajane may help with using https://github.com/errata-ai/vale-action