-
Notifications
You must be signed in to change notification settings - Fork 52
56 lines (47 loc) · 1.87 KB
/
canary-pr-review.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
56
name: Vale Linting and PR Review
on: [pull_request]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Get all changed markdown files
id: changed-markdown-files
uses: tj-actions/changed-files@v41
with:
files: |
**.md
- name: List all changed files markdown files
if: steps.changed-markdown-files.outputs.any_changed == 'true'
run: |
for file in ${{ steps.changed-markdown-files.outputs.all_changed_files }}; do
echo "$file was changed"
done
- name: Calculate changed files to pass to Vale
id: calc_changed_files
run: |
beginning='['
# File calculation without folder filtering
middle=$(echo ${{ steps.changed-markdown-files.outputs.all_changed_files }} | sed 's/ /", "/g; s/^/"/; s/$/"/')
# File calculation applying folder filtering for azure_arc_app_svc & azure_arc_k8s
#middle=$(echo ${{ steps.changed-markdown-files.outputs.all_changed_files }} | tr ' ' '\n' | grep -E '^\docs\/azure_arc_jumpstart\/(azure_arc_app_svc|azure_arc_k8s|azure_jumpstart_ag)\/.*$' | sed 's/^/"/;s/$/"/' | paste -sd,)
end=']'
echo "files_to_change=$beginning$middle$end"
echo "files_to_change=$beginning$middle$end" >> $GITHUB_ENV
files_to_change=$beginning$middle$end
if [[ ! "$files_to_change" =~ \[[[:space:]]*\] ]]; then
echo "run_vale=Yes" >> $GITHUB_ENV
else
echo "run_vale=No" >> $GITHUB_ENV
fi
- name: Vale
if: ${{ env.run_vale != 'No' }}
uses: errata-ai/vale-action@reviewdog
with:
version: 2.30.0
reporter: github-pr-check
filter_mode: nofilter
fail_on_error: true
files: '${{ env.files_to_change }}'
token: ${{secrets.GITHUB_TOKEN}}