@@ -6,7 +6,7 @@ name: Code Quality
66
77on :
88 push :
9- branches : ["* "]
9+ branches : ["main "]
1010 paths :
1111 - " recipes/**/*.js"
1212 - " recipes/**/*.ts"
1515 - " utils/**/*.ts"
1616 - " utils/package.json"
1717 - " package.json"
18- - " .github/workflows/ci .yml"
18+ - " .github/workflows/code-quality .yml"
1919 pull_request :
2020 branches : ["*"]
2121 paths :
2626 - " utils/**/*.ts"
2727 - " utils/**/package.json"
2828 - " package.json"
29- - " .github/workflows/ci .yml"
29+ - " .github/workflows/code-quality .yml"
3030 types :
3131 - opened
3232 - ready_for_review
@@ -37,39 +37,16 @@ permissions:
3737 contents : read
3838
3939jobs :
40- get-matrix :
41- name : Get Node + OS matrix
42- runs-on : ubuntu-latest
43-
44- if : ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }}
45-
46- outputs :
47- latest : ${{ steps.set-matrix.outputs.requireds }}
48- steps :
49- - name : Harden the runner (Audit all outbound calls)
50- uses : step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
51- with :
52- egress-policy : audit
53-
54- - uses : ljharb/actions/node/matrix@7f214d8efdbdcefc96ad9689663ef387a195deec # main
55- id : set-matrix
56- with :
57- versionsAsRoot : true
58- type : majors
59- preset : " >= 22" # glob is not backported below 22.x
60-
6140 lint-and-types :
6241 name : Lint & types
6342 runs-on : ubuntu-slim
64-
6543 if : ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }}
6644
6745 steps :
68- # FIXME https://github.com/step-security/harden-runner/issues/627
69- # - name: Harden the runner (Audit all outbound calls)
70- # uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
71- # with:
72- # egress-policy: audit
46+ - name : Harden the runner (Audit all outbound calls)
47+ uses : step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0
48+ with :
49+ egress-policy : audit
7350
7451 - uses : actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
7552 with :
@@ -83,20 +60,19 @@ jobs:
8360 test :
8461 name : Before/After tests
8562 runs-on : ${{ matrix.os }}
86-
8763 if : ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }}
8864
8965 strategy :
9066 fail-fast : false
9167 matrix :
9268 os :
9369 - macos-latest
94- - ubuntu-latest
70+ - ubuntu-slim
9571 - windows-latest
9672
9773 steps :
9874 - name : Harden the runner (Audit all outbound calls)
99- uses : step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
75+ uses : step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0
10076 with :
10177 egress-policy : audit
10278
10682 persist-credentials : false
10783 show-progress : false
10884
85+ # ubuntu-slim already include lts node so we don't need to setup node on ubuntu-slim runner
10986 - name : Set up Node.js
87+ if : ${{ matrix.os != 'ubuntu-slim' }}
11088 uses : actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
11189 with :
11290 cache : " npm"
11896 - name : Run tests related to changes
11997 shell : bash
12098 run : >
121- changed_paths=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }})
99+ changed_paths=$(git diff --name-only ${{ github.event.pull_request.base.sha || github.event.before }} ${{ github.sha }})
122100
123101 # run everything?
124102 if echo "$changed_paths" | grep -qE '^(package\.json|\.github/workflows/ci\.yml|utils/)$'; then
@@ -129,8 +107,8 @@ jobs:
129107 # run for specific workspace(s)
130108 npm run test $(
131109 echo "$changed_paths" \
132- | grep '^recipes/'
133- | cut -d/ -f1,2
134- | sort -u
110+ | grep '^recipes/' \
111+ | cut -d/ -f1,2 \
112+ | sort -u \
135113 | sed 's/^/--workspace=/'
136114 )
0 commit comments