Skip to content

Commit 0c560c6

Browse files
varruunnnvanshika2720
authored andcommitted
npm dependencies cache (sugarlabs#5345)
1 parent 957becb commit 0c560c6

File tree

1 file changed

+43
-42
lines changed

1 file changed

+43
-42
lines changed

.github/workflows/linter.yml

Lines changed: 43 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,48 @@
11
name: ESLint
22

33
on:
4-
pull_request:
5-
branches: [master]
4+
pull_request:
5+
branches: [master]
66

77
jobs:
8-
lint:
9-
name: Lint updated JavaScript files with ESLint
10-
11-
runs-on: ubuntu-latest
12-
13-
steps:
14-
- name: Checkout code
15-
uses: actions/checkout@v4
16-
with:
17-
fetch-depth: 0
18-
ref: ${{ github.event.pull_request.head.sha }}
19-
20-
- name: Set up Node.js
21-
uses: actions/setup-node@v4
22-
with:
23-
node-version: 20.x
24-
25-
- name: Get changed JavaScript files
26-
id: get_files
27-
run: |
28-
CHANGED_FILES=$(git diff --diff-filter=ACMRT --name-only ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} -- '*.js')
29-
echo "files<<EOF" >> $GITHUB_ENV
30-
echo "$CHANGED_FILES" >> $GITHUB_ENV
31-
echo "EOF" >> $GITHUB_ENV
32-
33-
- name: Install dependencies
34-
run: npm ci
35-
36-
- name: Run ESLint on changed files
37-
if: env.files != ''
38-
run: |
39-
echo "Linting the following files:"
40-
echo "$files"
41-
echo "$files" | xargs npx eslint
42-
- name: Run Prettier check on changed files
43-
if: env.files != ''
44-
run: |
45-
echo "Checking formatting for the following files:"
46-
echo "$files"
47-
echo "$files" | xargs npx prettier --check
8+
lint:
9+
name: Lint updated JavaScript files with ESLint
10+
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
ref: ${{ github.event.pull_request.head.sha }}
19+
20+
- name: Set up Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: 20.x
24+
cache: "npm"
25+
26+
- name: Get changed JavaScript files
27+
id: get_files
28+
run: |
29+
CHANGED_FILES=$(git diff --diff-filter=ACMRT --name-only ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} -- '*.js')
30+
echo "files<<EOF" >> $GITHUB_ENV
31+
echo "$CHANGED_FILES" >> $GITHUB_ENV
32+
echo "EOF" >> $GITHUB_ENV
33+
34+
- name: Install dependencies
35+
run: npm ci
36+
37+
- name: Run ESLint on changed files
38+
if: env.files != ''
39+
run: |
40+
echo "Linting the following files:"
41+
echo "$files"
42+
echo "$files" | xargs npx eslint
43+
- name: Run Prettier check on changed files
44+
if: env.files != ''
45+
run: |
46+
echo "Checking formatting for the following files:"
47+
echo "$files"
48+
echo "$files" | xargs npx prettier --check

0 commit comments

Comments
 (0)