Skip to content

Commit 69b6503

Browse files
author
David Cavazos
committed
feat: run lint only on affected packages
1 parent e169459 commit 69b6503

File tree

2 files changed

+33
-5
lines changed

2 files changed

+33
-5
lines changed
File renamed without changes.

.github/workflows/ci-prod.yaml renamed to .github/workflows/custard-ci.yaml

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,44 @@ 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+
84+
let failed = false;
85+
for (const path of affected) {
86+
try {
87+
execSync(cmd, {cwd: path});
88+
console.log(`✅ [${path}]: ${cmd}`);
89+
} catch (e) {
90+
failed = true;
91+
console.log(`❌ [${path}]: ${cmd} (status ${e.status})`);
92+
console.log('--- stdout ---');
93+
console.log(e.stdout.toString("utf8"));
94+
console.log('--- stderr ---');
95+
console.log(e.stderr.toString("utf8"));
96+
}
97+
}
98+
if (failed) {
99+
process.exit(1)
100+
}
73101
74102
region-tags:
75103
name: region tags

0 commit comments

Comments
 (0)