-
Notifications
You must be signed in to change notification settings - Fork 606
137 lines (133 loc) · 3.96 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: Linting
on:
pull_request:
types: [synchronize, ready_for_review, opened]
concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
env:
BUNDLE_GITHUB__COM: x-access-token:${{ secrets.BUNDLE_GITHUB__COM }}
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 }}
prettier:
needs: check
if: needs.check.outputs.result == 'false'
name: Prettier
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 100
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- run: npm ci
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v45
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@v4
with:
submodules: 'recursive'
# 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@v4
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
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/**
files_ignore: |
app/_src/.repos/kuma/**
app/gateway/2.7.x/**
app/gateway/2.6.x/**
app/assets/mesh/raw/CHANGELOG.md
app/assets/mesh/raw/UPGRADE.md
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}}
unreleased-version:
needs: check
if: needs.check.outputs.result == 'false'
name: Unreleased Version
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Check Unreleased label
run: |
cd tools/check-unreleased-label
npm ci
node run.js