File tree Expand file tree Collapse file tree 2 files changed +24
-11
lines changed Expand file tree Collapse file tree 2 files changed +24
-11
lines changed Original file line number Diff line number Diff line change @@ -20,14 +20,11 @@ jobs:
20
20
show-progress : false
21
21
sparse-checkout : |
22
22
commitlint.config.ts
23
- package.json
24
23
packages/*/package.json
25
24
sparse-checkout-cone-mode : false
26
25
27
- - name : Install PNPM
28
- uses : pnpm/action-setup@v4
29
-
30
26
- name : Lint Pull Request Title
31
27
run : |
32
- pnpm install
33
- echo '${{ github.event.pull_request.title }}' | pnpm commitlint --config commitlint.config.ts
28
+ npm init --scope=clerk --yes
29
+ npm i --save-dev @commitlint/config-conventional @commitlint/cli globby --audit=false --fund=false
30
+ echo '${{ github.event.pull_request.title }}' | npm exec @commitlint/cli -- --config commitlint.config.ts
Original file line number Diff line number Diff line change 1
1
// All imports must be accounted for per `npm i` in .github/workflows/pr-title-linter.yml
2
- import { globbySync } from 'globby ' ;
3
- import { readFileSync } from 'node:fs ' ;
2
+ import { readdirSync , readFileSync , statSync } from 'node:fs ' ;
3
+ import { join } from 'node:path ' ;
4
4
5
5
const getPackageNames = ( ) => {
6
- const files = globbySync ( './packages/*/package.json' ) ;
7
- const names = files . map ( f => JSON . parse ( readFileSync ( f , 'utf8' ) ) . name as string ) ;
8
- return names . map ( n => n . split ( '/' ) . pop ( ) ) ;
6
+ const packagesDir = './packages' ;
7
+ const entries = readdirSync ( packagesDir ) ;
8
+ const packageNames = entries
9
+ . filter ( entry => {
10
+ const fullPath = join ( packagesDir , entry ) ;
11
+ return statSync ( fullPath ) . isDirectory ( ) ;
12
+ } )
13
+ . map ( dir => {
14
+ const packageJsonPath = join ( packagesDir , dir , 'package.json' ) ;
15
+ try {
16
+ const packageJson = JSON . parse ( readFileSync ( packageJsonPath , 'utf8' ) ) ;
17
+ return packageJson . name . split ( '/' ) . pop ( ) ;
18
+ } catch {
19
+ // Ignore directories without a package.json
20
+ return null ;
21
+ }
22
+ } )
23
+ . filter ( Boolean ) ;
24
+ return packageNames ;
9
25
} ;
10
26
11
27
const Configuration = {
You can’t perform that action at this time.
0 commit comments