-
Notifications
You must be signed in to change notification settings - Fork 5
67 lines (55 loc) · 1.56 KB
/
main.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
name: ESLint
on: [pull_request]
jobs:
eslint:
name: Run eslint scan
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
actions: read
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
path: main
- name: Checkout ESLint config repository
uses: actions/checkout@v4
with:
path: lint
repository: WazeDev/Eslint-Config
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Restore Cached NPM
uses: actions/cache/restore@v4
id: npm-cache
with:
path: lint/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/eslint.config.mjs') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install ESLint config dependencies
if: steps.npm-cache.outputs.cache-hit != 'true'
run: |
cd lint
npm install
- name: Cache NPM Packages
if: steps.npm-cache.outputs.cache-hit != 'true'
id: npm-cache-save
uses: actions/cache/save@v4
with:
path: lint/node_modules
key: ${{ steps.npm-cache.outputs.cache-primary-key }}
- name: Copy JS files to lint folder
run: |
cp main/*.js lint/
ls lint
- name: Run ESLint
uses: reviewdog/action-eslint@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workdir: lint
eslint_flags: "**/*.js --config eslint.config.mjs"