-
Notifications
You must be signed in to change notification settings - Fork 1
76 lines (75 loc) · 2.52 KB
/
linting.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: Linting
on:
pull_request:
types: [synchronize, ready_for_review, opened, labeled]
concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
jobs:
check:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check if manual review has been performed
uses: actions/github-script@v7
id: labels
with:
result-encoding: string
script: |
const { data: labels } = await github.rest.issues.listLabelsOnIssue({
...context.repo,
issue_number: context.issue.number
});
return labels.map(l => l.name).includes('ci:manual-approve:linting')
outputs:
result: ${{ steps.labels.outputs.result }}
vale:
needs: check
if: needs.check.outputs.result == 'false'
name: Vale
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v45
with:
sha: ${{ github.sha }}
files: |
app/**/*.md
app/_landing_pages/**/*.yaml
files_ignore: |
app/assets/**
json: true
quotepath: false
escape_json: false
- uses: mheap/vale-action@reviewdog
if: steps.changed-files.outputs.any_changed == 'true'
with:
fail_on_error: true
files: '${{ steps.changed-files.outputs.all_changed_files }}'
filter_mode: file
reporter: github-pr-annotations
reviewdog_url: https://github.com/mheap/reviewdog/releases/download/v10.0.0/reviewdog_10.0.0_Linux_x86_64.tar.gz
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Prepare Frontmatters for Vale
env:
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
cd tools/vale-frontmatter
npm ci
node index.js $CHANGED_FILES
- uses: mheap/vale-action@reviewdog
if: steps.changed-files.outputs.any_changed == 'true'
with:
fail_on_error: true
files: '${{ steps.changed-files.outputs.all_changed_files }}'
filter_mode: file
reporter: github-pr-annotations
reviewdog_url: https://github.com/mheap/reviewdog/releases/download/v10.0.0/reviewdog_10.0.0_Linux_x86_64.tar.gz
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}