-
Notifications
You must be signed in to change notification settings - Fork 395
45 lines (38 loc) · 1.17 KB
/
frontend-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
name: Frontend Lint
on:
# Allows you to reuse workflows by referencing their YAML files
workflow_call:
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
defaults:
run:
working-directory: ./webapp
steps:
- uses: actions/checkout@v4
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: yarn
cache-dependency-path: webapp/yarn.lock
- name: restore node_modules
uses: actions/cache@v4
with:
path: "**/node_modules"
key: ${{ runner.os }}-node_modules-${{ hashFiles('webapp/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node_modules-
- run: |
yarn install --immutable
git fetch origin "${{ github.base_ref }}" --depth=1
FILES=$(git diff --name-only 'origin/${{ github.base_ref }}' ${{ github.sha }} -- . | sed 's|^webapp/||')
if [ -n "$FILES" ]; then
yarn lint --pass-on-no-patterns --no-error-on-unmatched-pattern $FILES
else
echo "No files to lint"
fi