The official GitHub Action for Vale -- install, manage, and run Vale with ease.
Important
This repository has moved to vale-cli/vale-action.
The errata-ai organization has been renamed to vale-cli. You must update your workflows to continue using the action:
- uses: errata-ai/vale-action@v2
+ uses: vale-cli/vale-action@v3Warning
Pinning the reviewdog branch (vale-cli/vale-action@reviewdog) tracks
whatever lands there next. Pin @v3 for this release, or @v2 to stay on
the previous one.
Add the following (or similar) to one of your .github/workflows files:
name: reviewdog
on: [pull_request]
jobs:
vale:
name: runner / vale
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: vale-cli/vale-action@v3Tip
If you're using a markup format other than Markdown, you may need to install
an external parser before calling vale-action:
# For AsciiDoc users:
- name: Install Asciidoctor
run: sudo apt-get install -y asciidoctor
# For reStructuredText users:
- name: Install docutils
run: sudo apt-get install -y docutilsSee the Vale documentation for more information.
The action runs on the Linux, macOS, and Windows runners, on both x86-64 and ARM. The one gap is Windows on ARM, which Vale has no build for.
Vale knows how to resolve some of the alerts it reports -- a substitution knows what to swap in, a spelling error has candidate spellings -- which the action offers as suggested changes that reviewers can commit from the pull request itself.
This requires the github-pr-review reporter, since it's the only one that
posts review comments:
- uses: vale-cli/vale-action@v3
with:
reporter: github-pr-reviewA suggestion is only offered when the rule declares an action and the flagged text still matches what's in the file, so alerts that span markup are reported without one.
Note
A pull request from a fork runs with a read-only token, and posting a
review comment is a write. Suggestions -- and the github-pr-check and
github-check reporters, which write a check run -- are unavailable there.
The default reporter still annotates a fork's pull request: it writes those through the runner's log rather than the API, which needs no write access.
The recommended repository structure makes use of the existing .github
directory to hold all of our Vale-related resources:
.github
├── styles
│ └── vocab.txt
└── workflows
└── main.yml
.vale.ini
...
Where styles represents your StylesPath. The top-level .vale.ini
file should reference this directory:
StylesPath = .github/styles
MinAlertLevel = suggestion
[*.md]
BasedOnStyles = Valevale sync downloads every package your configuration names, every time
it runs. To download them only when they change, restore the StylesPath
from a cache and tell the action to skip the sync on a hit:
- uses: actions/cache@v4
id: styles
with:
path: .github/styles
key: vale-${{ hashFiles('.vale.ini') }}
- uses: vale-cli/vale-action@v3
with:
sync: ${{ steps.styles.outputs.cache-hit != 'true' }}The Vale and reviewdog binaries go into the runner's tool cache, which a
self-hosted runner keeps between jobs. The hosted runners start each job on a
fresh machine, so there they're downloaded once per job.
You can further customize the linting processing by providing one of the following optional inputs.
To add an input, edit your workflow file and add the with key to the uses
block. For example:
- uses: vale-cli/vale-action@v3
with:
version: 2.17.0NOTE: The provided version must be
>= 2.16.0.
Specify the Vale CLI version to use. If none, any preinstalled version of vale
is used.
with:
version: 2.17.0files specifies where Vale will look for files to lint.
with:
files: path/to/lintYou can supply this value one of four ways:
-
files: all(default): The repo's root directory; equivalent to callingvale .. -
files: path/to/lint: A single file or directory; equivalent to callingvale path/to/lint. -
files: '["input1", "input2"]': A JSON-formatted list of file or directory arguments; equivalent to callingvale input1 input2. -
files: 'input1,input2': A character-delimited list of files. The character is determined by the input valueseparator:with: separator: ","
Run vale sync before linting. Set to false when you restore the
StylesPath from a cache yourself; see Caching.
with:
sync: falseSet the reporter type.
with:
# github-pr-check, github-pr-review, github-check
reporter: github-pr-checkBy default, the action succeeds whatever Vale reports. With fail_on_error,
it fails when Vale reports an alert at the error level -- and only then, so
a warning or a suggestion still passes.
with:
fail_on_error: trueThe severity at which the run fails: none, any, info, warning, or
error. It takes precedence over fail_on_error, which is the same setting
with two positions rather than five.
with:
fail_level: warningNeeds reviewdog 0.21.0 or later; see reviewdog_version.
Set the filter mode for
reviewdog.
with:
# added, diff_context, file, nofilter
filter_mode: nofilterA path to the .vale.ini to lint with, for a configuration that doesn't sit
where Vale would look for it.
with:
config: docs/.vale.iniAn expression that decides which rules run. Report only errors, or only one style, without editing the configuration:
with:
filter: '.Level == "error"'A glob pattern limiting which files Vale reads.
with:
glob: '*.{md,txt}'The lowest level worth reporting: suggestion, warning, or error.
with:
min_alert_level: warningSpace-delimited list of flags for the Vale CLI. To see a full list of available
flags, run vale -h.
Anything without an input of its own goes here. Quotes group what they surround, as they would in a shell, so a flag can carry spaces:
with:
vale_flags: "--glob=*.txt --filter='.Level == \"error\"'"A backslash means a backslash rather than an escape, so Windows paths need no special handling.
The report level for
reviewdog, which decides what a check reporter concludes: error fails the
check, info and warning leave it neutral.
with:
# info, warning, error
level: errorLeft unset, the level follows fail_on_error and whether Vale found errors.
The directory to run Vale in, relative to the repository root. Use it when
the .vale.ini lives somewhere other than the top level.
with:
workdir: docsThe character that splits the files input into a list; see
files.
with:
separator: ","Log the resolved Vale version and arguments.
with:
debug: trueThe reviewdog release to install. The action checks each download against
the release's published checksums.
with:
reviewdog_version: 0.21.0A URL to a tar.gz build of reviewdog to use in place of the published
release. A build named this way skips both the tool cache and the checksum
check, since neither has anything to say about it.
with:
reviewdog_url: https://example.com/reviewdog.tar.gztoken (default: secrets.GITHUB_TOKEN)
The GitHub token to use.
with:
token: ${{secrets.VALE_GITHUB_TOKEN}}