forked from Kong/docs.konghq.com
-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (90 loc) · 2.64 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: Linting
on:
pull_request:
types: [synchronize, ready_for_review, opened]
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Check if manual review has been performed
uses: actions/github-script@v6
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 }}
prettier:
needs: check
if: needs.check.outputs.result == 'false'
name: Prettier
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 100
- uses: actions/setup-node@v3
with:
node-version: 16
cache: 'npm'
- run: npm ci
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v35
with:
sha: ${{ github.sha }}
files: |
app/_src/**
app/_assets/**
files_ignore: |
app/_src/.repos/kuma/**
- run: npx prettier --check ${{ steps.changed-files.outputs.all_changed_files }}
rubocop:
needs: check
if: needs.check.outputs.result == 'false'
name: Rubocop
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
# Configure Ruby to build Jekyll site
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: .ruby-version
- name: Ruby gem cache
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Bundle Setup
run: bundle config path ${{ github.workspace }}/vendor/bundle
- name: Bundle Install
run: bundle install --jobs 4 --retry 3
- name: Rubocop
run: |
bundle exec rubocop app
vale:
needs: check
if: needs.check.outputs.result == 'false'
name: Vale
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: errata-ai/vale-action@v2
with:
# path where vale checks checking only modified files.
filter_mode: file
fail_on_error: true
vale_flags: "--glob=!app/_src/.repos/kuma/**"
reporter: github-pr-review
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}