4141 cache : ' npm'
4242 registry-url : ' https://npm.pkg.github.com/'
4343 cache-dependency-path : ' **/package-lock.json'
44- always-auth : true
4544
4645 - name : Install dependencies
4746 run : npm ci
@@ -52,74 +51,42 @@ jobs:
5251 continue-on-error : true
5352
5453 - name : Build
54+ uses : ./.github/actions/run-npm-script
5555 id : build
56- continue-on-error : true
57- run : |
58- if ! [ -f package.json ] || ! jq -e '.scripts.build' package.json > /dev/null; then
59- echo "No build script found in package.json."
60- echo "build_status=notpresent" >> $GITHUB_OUTPUT
61- exit 0
62- fi
63- if npm run build; then
64- echo "build_status=success" >> $GITHUB_OUTPUT
65- else
66- echo "build_status=failure" >> $GITHUB_OUTPUT
67- fi
56+ with :
57+ working-directory : ' .'
58+ script : build
6859
6960 - name : Lint
61+ uses : ./.github/actions/run-npm-script
7062 id : lint
71- continue-on-error : true
72- run : |
73- if ! [ -f package.json ] || ! jq -e '.scripts.["lint:check"]' package.json > /dev/null; then
74- echo "No lint script found in package.json."
75- echo "lint_status=notpresent" >> $GITHUB_OUTPUT
76- exit 0
77- fi
78- if npm run lint:check; then
79- echo "lint_status=success" >> $GITHUB_OUTPUT
80- else
81- echo "lint_status=failure" >> $GITHUB_OUTPUT
82- fi
63+ with :
64+ working-directory : ' .'
65+ script : lint:check
8366
8467 - name : Format
68+ uses : ./.github/actions/run-npm-script
8569 id : format
86- continue-on-error : true
87- run : |
88- if ! [ -f package.json ] || ! jq -e '.scripts.["format:check"]' package.json > /dev/null; then
89- echo "No format script found in package.json."
90- echo "format_status=notpresent" >> $GITHUB_OUTPUT
91- exit 0
92- fi
93- if npm run format:check; then
94- echo "format_status=success" >> $GITHUB_OUTPUT
95- else
96- echo "format_status=failure" >> $GITHUB_OUTPUT
97- fi
70+ with :
71+ working-directory : ' .'
72+ script : format:check
9873
9974 - name : Test
75+ uses : ./.github/actions/run-npm-script
10076 id : test
101- continue-on-error : true
102- run : |
103- if ! [ -f package.json ] || ! jq -e '.scripts.test' package.json > /dev/null; then
104- echo "No test script found in package.json."
105- echo "test_status=notpresent" >> $GITHUB_OUTPUT
106- exit 0
107- fi
108- if npm test; then
109- echo "test_status=success" >> $GITHUB_OUTPUT
110- else
111- echo "test_status=failure" >> $GITHUB_OUTPUT
112- fi
77+ with :
78+ working-directory : ' .'
79+ script : test
11380
11481 - name : Job Summary
11582 if : always()
11683 env :
11784 AUDIT_STATUS : ${{ steps.audit-npm.outputs.gate_passed == 'true' && 'success' || 'failure' }}
11885 AUDIT_SUMMARY : ${{ steps.audit-npm.outputs.gate_summary }}
119- BUILD_STATUS : ${{ steps.build.outputs.build_status || steps.build.outcome }}
120- LINT_STATUS : ${{ steps.lint.outputs.lint_status || steps.lint.outcome }}
121- FORMAT_STATUS : ${{ steps.format.outputs.format_status || steps.format.outcome }}
122- TEST_STATUS : ${{ steps.test.outputs.test_status || steps.test.outcome }}
86+ BUILD_STATUS : ${{ steps.build.outputs.status || steps.build.outcome }}
87+ LINT_STATUS : ${{ steps.lint.outputs.status || steps.lint.outcome }}
88+ FORMAT_STATUS : ${{ steps.format.outputs.status || steps.format.outcome }}
89+ TEST_STATUS : ${{ steps.test.outputs.status || steps.test.outcome }}
12390 run : |
12491 status_emoji () {
12592 case "$1" in
@@ -146,13 +113,13 @@ jobs:
146113 cat job-summary.md >> "$GITHUB_STEP_SUMMARY"
147114
148115 - name : Set Run Outcome
149- if : ${{ steps.audit-npm.outputs.gate_passed == 'false' || steps.build.outputs.build_status == 'failure' || steps.lint.outputs.lint_status == 'failure' || steps.format.outputs.format_status == 'failure' || steps.test.outputs.test_status == 'failure' }}
116+ if : ${{ steps.audit-npm.outputs.gate_passed == 'false' || steps.build.outputs.status == 'failure' || steps.lint.outputs.status == 'failure' || steps.format.outputs.status == 'failure' || steps.test.outputs.status == 'failure' }}
150117 env :
151118 AUDIT_STATUS : ${{ steps.audit-npm.outputs.gate_passed == 'true' && 'passed' || 'failed' }}
152- BUILD_STATUS : ${{ steps.build.outputs.build_status == 'success' && 'passed' || 'failed' }}
153- LINT_STATUS : ${{ steps.lint.outputs.lint_status == 'success' && 'passed' || 'failed' }}
154- FORMAT_STATUS : ${{ steps.format.outputs.format_status == 'success' && 'passed' || 'failed' }}
155- TEST_STATUS : ${{ steps.test.outputs.test_status == 'success' && 'passed' || 'failed' }}
119+ BUILD_STATUS : ${{ steps.build.outputs.status == 'success' && 'passed' || 'failed' }}
120+ LINT_STATUS : ${{ steps.lint.outputs.status == 'success' && 'passed' || 'failed' }}
121+ FORMAT_STATUS : ${{ steps.format.outputs.status == 'success' && 'passed' || 'failed' }}
122+ TEST_STATUS : ${{ steps.test.outputs.status == 'success' && 'passed' || 'failed' }}
156123 run : |
157124 echo "❌ One or more gate steps failed:"
158125 echo " Audit Gate: $AUDIT_STATUS"
0 commit comments