errata-ai / vale-action

:octocat: The official GitHub Action for Vale -- install, manage, and run Vale with ease.
MIT License
192 stars 44 forks source link

How to check all files of a filetype but exclude some #37

Closed paddyroddy closed 2 years ago

paddyroddy commented 3 years ago

So I have a directory structure that's a bit like this, where basically in the include directory there are many subdirectories all including *.tex files:

.
├── README.md
├── background.tex
├── include
│   ├── background
│   │   ├── cosmology
│   │   │   ├── geometry_dynamics
│   │   │   │   ├── dynamics.tex
├── letter_convolution.tex
├── letter_convolution_editor_response.tex
├── letter_convolution_referee_response.tex
├── note.tex
├── paper_slepian_manifolds.tex
├── paper_slepian_wavelets.tex
├── poster.tex
├── presentation.tex
├── test.md
└── thesis_plan.tex

what I want to do is to check all *.tex files except the two of the form letter_convolution_*.tex (as they're full of issues I'm not going to fix).

My .vale.ini file looks like:

StylesPath = .vale-styles

[*.tex]
BasedOnStyles=vale

On the command line I know I can achieve this by doing vale --glob='!letter_convolution_*' *.

How do I do it with the extension? I've tried adjusting the [...] in .vale.ini but cannot get it to work. Is there a config option within the CI itself?

jdkato commented 3 years ago

There isn't a great way to do this at the moment.

I'll look into exposing the --glob option to the action's config.

jdkato commented 2 years ago

This is now possible by using the new reviewdog-based action with vale_flags:

name: reviewdog
on: [pull_request]

jobs:
  vale:
    name: runner / vale
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: errata-ai/vale-action@reviewdog
        with:
          fail_on_error: true
          vale_flags: "--glob='*.txt'"
          debug: true
        env:
          GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
paddyroddy commented 2 years ago

This is great! For those interested, my problem can now be solved succinctly with:

vale:
    runs-on: ubuntu-latest
    steps:
        - name: checkout source
          uses: actions/checkout@v3

        - name: Run Vale
          uses: errata-ai/vale-action@reviewdog
          env:
              GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
          with:
              reporter: github-check
              vale_flags: "--glob='!*{_response,misc/}*'"

I wanted to ignore any file which included the word _response or in the folder misc/