@@ -60,16 +60,51 @@ jobs:
6060 cat paths.txt
6161 echo "setups=$(./cloud-samples-tools/bin/custard setup-files .github/config/nodejs-prod.jsonc paths.txt)" >> $GITHUB_OUTPUT
6262
63- nodejs- lint :
64- name : lint
63+ lint :
64+ needs : affected
6565 runs-on : ubuntu-latest
6666 timeout-minutes : 5
6767 steps :
68- - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
69- - uses : actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
68+ - name : Checkout
69+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
70+ - name : Setup Node
71+ uses : actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
7072 with :
7173 node-version : 20
72- - run : make lint
74+ - run : npm install
75+ - name : Run lint
76+ uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
77+ with :
78+ script : |
79+ const { execSync } = await import("node:child_process");
80+
81+ const cmd = 'npx gts lint';
82+ const affected = ${{ needs.affected.outputs.nodejs-paths }};
83+ if (affected.length === 0) {
84+ console.log("No packages were affected, nothing to lint.")
85+ }
86+
87+ let failed = [];
88+ for (const path of affected) {
89+ try {
90+ execSync(cmd, {cwd: path});
91+ console.log(`✅ [${path}]: ${cmd}`);
92+ } catch (e) {
93+ failed.push(path)
94+ console.log(`❌ [${path}]: ${cmd} (exit code ${e.status})`);
95+ core.error(e.message);
96+ console.log('--- stdout ---');
97+ console.log(e.stdout.toString("utf8"));
98+ console.log('--- stderr ---');
99+ console.log(e.stderr.toString("utf8"));
100+ }
101+ }
102+ console.log("=== Summary ===")
103+ console.log(` Passed: ${affected.length - failed.length}`)
104+ console.log(` Failed: ${failed.length}`)
105+ if (failed.length > 0) {
106+ core.setFailed(`Failed '${cmd}' on: ${failed.join(', ')}`)
107+ }
73108
74109 region-tags :
75110 name : region tags
82117 node-version : 20
83118 - run : ./.github/workflows/utils/region-tags-tests.sh
84119
85- nodejs-test :
86- name : test
120+ test :
87121 needs : affected
88122 runs-on : ubuntu-latest
89123 timeout-minutes : 120 # 2 hours hard limit
0 commit comments