-
Notifications
You must be signed in to change notification settings - Fork 982
55 lines (46 loc) · 1.67 KB
/
vale.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Vale lint checker
on:
pull_request:
branches:
- '**'
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0 # Ensure the full history is fetched
- name: Cache Vale binary
uses: actions/cache@v3
with:
path: ~/.vale
key: ${{ runner.os }}-vale-${{ hashFiles('**/.vale.ini') }}
restore-keys: |
${{ runner.os }}-vale-
- name: Set up vale
uses: errata-ai/vale-action@reviewdog
with:
files: '["website/docs/docs", "website/docs/reference", "website/docs/guides"]'
token: ${{ secrets.VALE_GITHUB_TOKEN }}
reporter: github-pr-check
- name: Get changed files
id: changed-files
run: |
git fetch origin ${{ github.base_ref }} ${{ github.head_ref }}
CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }} origin/${{ github.head_ref }} -- '*.md' '*.txt' '*.rst' | tr '\n' ' ')
echo "CHANGED_FILES=$CHANGED_FILES" >> $GITHUB_ENV
- name: Debug CHANGED_FILES
run: |
echo "Changed files: ${{ env.CHANGED_FILES }}"
- name: Set up Reviewdog
uses: reviewdog/action-setup@v1
- name: Run vale with reviewdog
run: |
if [ -z "${{ env.CHANGED_FILES }}" ]; then
echo "No changed files to lint."
else
for file in ${{ env.CHANGED_FILES }}; do
vale --output=JSON "$file" | reviewdog -f=vale -name="vale" -reporter=github-pr-check -level=warning -filter-mode=added -fail-on-error=true -tee
done
fi