Skip to content

Commit c35d919

Browse files
committed
Add pnpm frontend lint workflow
1 parent 2ae8f0e commit c35d919

1 file changed

Lines changed: 154 additions & 0 deletions

File tree

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
name: Lint frontend package (pnpm)
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
node-versions:
7+
description: "JSON list of node versions"
8+
required: false
9+
type: string
10+
default: '["24.x"]'
11+
12+
pnpm-version:
13+
description: "pnpm version to install"
14+
required: false
15+
type: string
16+
default: "10.33.4"
17+
18+
working-directory:
19+
description: "Path to the frontend project directory"
20+
required: false
21+
type: string
22+
default: "."
23+
24+
run-prettier:
25+
description: "Run prettier format check"
26+
required: false
27+
type: boolean
28+
default: true
29+
30+
run-eslint:
31+
description: "Run eslint linting"
32+
required: false
33+
type: boolean
34+
default: true
35+
36+
run-build:
37+
description: "Run build"
38+
required: false
39+
type: boolean
40+
default: true
41+
42+
run-unused-exports:
43+
description: "Run ts-unused-exports check"
44+
required: false
45+
type: boolean
46+
default: false
47+
48+
permissions:
49+
contents: read
50+
51+
jobs:
52+
check_formatting:
53+
if: ${{ inputs.run-prettier }}
54+
runs-on: ubuntu-latest
55+
strategy:
56+
matrix:
57+
node-version: ${{ fromJSON(inputs.node-versions) }}
58+
defaults:
59+
run:
60+
working-directory: ${{ inputs.working-directory }}
61+
steps:
62+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6
63+
- name: Install pnpm
64+
uses: pnpm/action-setup@b307475762933b98ed359c036b0e51f26b63b74b #v5
65+
with:
66+
version: ${{ inputs.pnpm-version }}
67+
- name: Use Node.js ${{ matrix.node-version }}
68+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e #v6
69+
with:
70+
node-version: ${{ matrix.node-version }}
71+
cache: "pnpm"
72+
cache-dependency-path: "**/pnpm-lock.yaml"
73+
- name: Install modules
74+
run: pnpm install --frozen-lockfile
75+
- name: Run Prettier
76+
run: pnpm run prettier_check
77+
78+
run_eslint:
79+
if: ${{ inputs.run-eslint }}
80+
runs-on: ubuntu-latest
81+
strategy:
82+
matrix:
83+
node-version: ${{ fromJSON(inputs.node-versions) }}
84+
defaults:
85+
run:
86+
working-directory: ${{ inputs.working-directory }}
87+
steps:
88+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6
89+
- name: Install pnpm
90+
uses: pnpm/action-setup@b307475762933b98ed359c036b0e51f26b63b74b #v5
91+
with:
92+
version: ${{ inputs.pnpm-version }}
93+
- name: Use Node.js ${{ matrix.node-version }}
94+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e #v6
95+
with:
96+
node-version: ${{ matrix.node-version }}
97+
cache: "pnpm"
98+
cache-dependency-path: "**/pnpm-lock.yaml"
99+
- name: Install modules
100+
run: pnpm install --frozen-lockfile
101+
- name: Run ESLint
102+
run: pnpm run lint
103+
104+
build:
105+
if: ${{ inputs.run-build }}
106+
runs-on: ubuntu-latest
107+
strategy:
108+
matrix:
109+
node-version: ${{ fromJSON(inputs.node-versions) }}
110+
defaults:
111+
run:
112+
working-directory: ${{ inputs.working-directory }}
113+
steps:
114+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6
115+
- name: Install pnpm
116+
uses: pnpm/action-setup@b307475762933b98ed359c036b0e51f26b63b74b #v5
117+
with:
118+
version: ${{ inputs.pnpm-version }}
119+
- name: Use Node.js ${{ matrix.node-version }}
120+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e #v6
121+
with:
122+
node-version: ${{ matrix.node-version }}
123+
cache: "pnpm"
124+
cache-dependency-path: "**/pnpm-lock.yaml"
125+
- name: Install modules
126+
run: pnpm install --frozen-lockfile
127+
- name: Build
128+
run: pnpm run build
129+
130+
check_exports:
131+
if: ${{ inputs.run-unused-exports }}
132+
runs-on: ubuntu-latest
133+
strategy:
134+
matrix:
135+
node-version: ${{ fromJSON(inputs.node-versions) }}
136+
defaults:
137+
run:
138+
working-directory: ${{ inputs.working-directory }}
139+
steps:
140+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6
141+
- name: Install pnpm
142+
uses: pnpm/action-setup@b307475762933b98ed359c036b0e51f26b63b74b #v5
143+
with:
144+
version: ${{ inputs.pnpm-version }}
145+
- name: Use Node.js ${{ matrix.node-version }}
146+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e #v6
147+
with:
148+
node-version: ${{ matrix.node-version }}
149+
cache: "pnpm"
150+
cache-dependency-path: "**/pnpm-lock.yaml"
151+
- name: Install modules
152+
run: pnpm install --frozen-lockfile
153+
- name: Run Unused Exports Check
154+
run: pnpm exec ts-unused-exports tsconfig.json

0 commit comments

Comments
 (0)