-
Notifications
You must be signed in to change notification settings - Fork 27
60 lines (52 loc) · 1.33 KB
/
lint.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
name: Run linter on pull request
on:
push:
branches:
- master
paths:
- '**.js'
- '!.lib/**'
pull_request:
branches:
- '*'
paths:
- '**.js'
- '!.lib/**'
env:
NODE_VERSION: '14'
jobs:
run-linter:
runs-on: ubuntu-latest
environment: development
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache-dependency-path: .lib/package-lock.json
- name: Make install
run: make install
- name: Get changed files
id: changed-parser
uses: tj-actions/changed-files@v35
with:
files: |
**/*.js
- name: Run lint test
shell: bash
run: |
ROOT_DIR=$(git rev-parse --show-toplevel)
ESLINT="${ROOT_DIR}/.lib/node_modules/eslint/bin/eslint.js --ext .js --no-ignore"
JSFILES=""
for file in ${{ steps.changed-parser.outputs.all_modified_files }}; do
JSFILES="$JSFILES $file"
done
if [ -n "$JSFILES" ]; then
echo "$JSFILES" | xargs node $ESLINT
if [ $? -ne 0 ]; then exit 1; fi
fi