From e7b677b009045981756712df310c91e82a0c845d Mon Sep 17 00:00:00 2001 From: Jacob Smith <3012099+JakobJingleheimer@users.noreply.github.com> Date: Mon, 27 Apr 2026 01:05:10 +0200 Subject: [PATCH 1/7] setup(workflow): `CI` run `test` only on changed workspace(s) --- .github/workflows/ci.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4f695f4f..a71fbc8a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,11 +62,10 @@ jobs: lint-and-types: name: Lint & types + runs-on: ubuntu-slim if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }} - runs-on: ubuntu-slim - steps: # FIXME https://github.com/step-security/harden-runner/issues/627 # - name: Harden the runner (Audit all outbound calls) @@ -85,11 +84,10 @@ jobs: test: name: Codemod JSSG tests + runs-on: ${{ matrix.os }} if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }} - runs-on: ${{ matrix.os }} - strategy: fail-fast: false matrix: @@ -117,4 +115,12 @@ jobs: node-version-file: ".nvmrc" - run: npm ci - - run: node --run test + + - run: > + npm run test $( + git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} + | grep '^recipes/' + | cut -d/ -f1,2 + | sort -u + | sed 's/^/--workspace=/' + ) From d476cabf9c6e8bef8d56cafb56089ad842f72d0d Mon Sep 17 00:00:00 2001 From: Jacob Smith <3012099+JakobJingleheimer@users.noreply.github.com> Date: Mon, 27 Apr 2026 01:23:37 +0200 Subject: [PATCH 2/7] differentiate between when to run everything and only some --- .github/workflows/ci.yml | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a71fbc8a..21324fc9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,6 @@ on: - "utils/**/*.ts" - "utils/package.json" - "package.json" - - "package-lock.json" - ".github/workflows/ci.yml" pull_request: branches: ["*"] @@ -27,7 +26,6 @@ on: - "utils/**/*.ts" - "utils/**/package.json" - "package.json" - - "package-lock.json" - ".github/workflows/ci.yml" types: - opened @@ -117,10 +115,20 @@ jobs: - run: npm ci - run: > + changed_paths=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }}) + + # run everything? + if echo "$changed_paths" | grep -qE '^(package\.json|\.github/workflows/ci\.yml)$'; then + npm run test --workspaces + exit 0 + fi + + # run for specific workspace(s) npm run test $( - git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} - | grep '^recipes/' - | cut -d/ -f1,2 + echo "$changed_paths" \ + | awk -F/ ' + /^packages\// { print "--workspace=" $1 "/" $2 } + /^utils\// { print "--workspace=utils" } + ' \ | sort -u - | sed 's/^/--workspace=/' ) From 3d231b812a86d13ffad68fc6979dab7a4d10ea2e Mon Sep 17 00:00:00 2001 From: Jacob Smith <3012099+JakobJingleheimer@users.noreply.github.com> Date: Mon, 27 Apr 2026 11:05:46 +0200 Subject: [PATCH 3/7] include `utils` in "run everything" --- .github/workflows/ci.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 21324fc9..8f2094d4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -118,7 +118,7 @@ jobs: changed_paths=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }}) # run everything? - if echo "$changed_paths" | grep -qE '^(package\.json|\.github/workflows/ci\.yml)$'; then + if echo "$changed_paths" | grep -qE '^(package\.json|\.github/workflows/ci\.yml|utils/)$'; then npm run test --workspaces exit 0 fi @@ -126,9 +126,8 @@ jobs: # run for specific workspace(s) npm run test $( echo "$changed_paths" \ - | awk -F/ ' - /^packages\// { print "--workspace=" $1 "/" $2 } - /^utils\// { print "--workspace=utils" } - ' \ + | grep '^recipes/' + | cut -d/ -f1,2 | sort -u + | sed 's/^/--workspace=/' ) From 313e48e56633f926dea90815099f592d0284ea66 Mon Sep 17 00:00:00 2001 From: Jacob Smith <3012099+JakobJingleheimer@users.noreply.github.com> Date: Tue, 28 Apr 2026 10:08:16 +0200 Subject: [PATCH 4/7] fixup!: checkout with some history --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8f2094d4..da239c08 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -102,6 +102,7 @@ jobs: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: + fetch-depth: 0 persist-credentials: false show-progress: false From d59e60bd2d8dd7baabc2b61ac9b61e6756bcd2b8 Mon Sep 17 00:00:00 2001 From: Jacob Smith <3012099+JakobJingleheimer@users.noreply.github.com> Date: Tue, 28 Apr 2026 10:14:04 +0200 Subject: [PATCH 5/7] fixup!: set the `shell` for running tests to `bash` --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index da239c08..9f8c56e8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -115,7 +115,9 @@ jobs: - run: npm ci - - run: > + - name: Run tests (determined by changeset) + shell: bash + run: > changed_paths=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }}) # run everything? From de5f72cb3f0504390395f3c6bcb6019e23a16b35 Mon Sep 17 00:00:00 2001 From: Jacob Smith <3012099+JakobJingleheimer@users.noreply.github.com> Date: Tue, 28 Apr 2026 10:23:55 +0200 Subject: [PATCH 6/7] wordsmith labels --- .github/workflows/{ci.yml => code-quality.yml} | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) rename .github/workflows/{ci.yml => code-quality.yml} (96%) diff --git a/.github/workflows/ci.yml b/.github/workflows/code-quality.yml similarity index 96% rename from .github/workflows/ci.yml rename to .github/workflows/code-quality.yml index 9f8c56e8..e6aba62a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/code-quality.yml @@ -2,7 +2,7 @@ # For more information see: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/running-variations-of-jobs-in-a-workflow -name: Quality Assurance +name: Code Quality on: push: @@ -38,7 +38,7 @@ permissions: jobs: get-matrix: - name: Configure Node environment matrix + name: Get Node environment matrix runs-on: ubuntu-latest if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }} @@ -81,7 +81,7 @@ jobs: - run: node --run type-check test: - name: Codemod JSSG tests + name: Before/After tests runs-on: ${{ matrix.os }} if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }} @@ -115,7 +115,7 @@ jobs: - run: npm ci - - name: Run tests (determined by changeset) + - name: Run tests related to changes shell: bash run: > changed_paths=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }}) From d9a08b29cb40139e47d38a0501e3402697b2a3dc Mon Sep 17 00:00:00 2001 From: Jacob Smith <3012099+JakobJingleheimer@users.noreply.github.com> Date: Tue, 28 Apr 2026 10:26:59 +0200 Subject: [PATCH 7/7] more word-smithing labels --- .github/workflows/code-quality.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index e6aba62a..a6dece75 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -38,7 +38,7 @@ permissions: jobs: get-matrix: - name: Get Node environment matrix + name: Get Node + OS matrix runs-on: ubuntu-latest if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }}