-
Notifications
You must be signed in to change notification settings - Fork 2k
feat: run lint only on affected packages #4022
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
69b6503
931e3ee
ecdd0e3
bfc5e8d
6a606b5
25dbc31
2fdbe5c
405be42
1a9b7a7
24e1885
982c62b
0c6493c
a93ef71
8ce1064
c8523d5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,16 +60,44 @@ jobs: | |
| cat paths.txt | ||
| echo "setups=$(./cloud-samples-tools/bin/custard setup-files .github/config/nodejs-prod.jsonc paths.txt)" >> $GITHUB_OUTPUT | ||
|
|
||
| nodejs-lint: | ||
| name: lint | ||
| lint: | ||
| needs: affected | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 5 | ||
| steps: | ||
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | ||
| - uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4 | ||
| - name: Checkout | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | ||
| - name: Setup Node | ||
| uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4 | ||
| with: | ||
| node-version: 20 | ||
| - run: make lint | ||
davidcavazos marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - run: npm install | ||
| - name: Run lint | ||
| uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7 | ||
| with: | ||
| script: | | ||
| const { execSync } = await import("node:child_process"); | ||
|
|
||
| const cmd = 'npx gts lint'; | ||
| const affected = ${{ needs.affected.outputs.nodejs-paths }}; | ||
|
|
||
| let failed = false; | ||
| for (const path of affected) { | ||
| try { | ||
| execSync(cmd, {cwd: path}); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. question: Is the lint output on a successful pass useful? If so, consider printing stdout/stderr in both cases.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a good question. I guess it depends on the lint tool. From the ones I've used they usually either don't have any output, or they just say something like "No issues found" or something like that. I was trying to keep the logs clean. We can always add this functionality if we find a case where it's useful. I'm adding this as part of our reusable workflows, so there could be an option to show stdout/stderr from successful commands as well. |
||
| console.log(`✅ [${path}]: ${cmd}`); | ||
| } catch (e) { | ||
| failed = true; | ||
| console.log(`❌ [${path}]: ${cmd} (status ${e.status})`); | ||
| console.log('--- stdout ---'); | ||
| console.log(e.stdout.toString("utf8")); | ||
| console.log('--- stderr ---'); | ||
| console.log(e.stderr.toString("utf8")); | ||
| } | ||
davidcavazos marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| if (failed) { | ||
| process.exit(1) | ||
| } | ||
|
|
||
| region-tags: | ||
| name: region tags | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.