From ab6209be6cc9cf93ad14004d6a84ecd532cb373a Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Tue, 27 Oct 2026 11:54:06 +0000 Subject: [PATCH 1/8] Exclude main project tests from `pr-checks/tsconfig.json` --- pr-checks/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pr-checks/tsconfig.json b/pr-checks/tsconfig.json index e0a6c856c..367148ab9 100644 --- a/pr-checks/tsconfig.json +++ b/pr-checks/tsconfig.json @@ -9,5 +9,5 @@ "noEmit": true }, "include": ["./**/*.ts", "../src/**/*.ts"], - "exclude": ["node_modules"] + "exclude": ["node_modules", "../src/**/*.test.ts"] } From 9b9c8e25e2a1de532783c33b13f01712209663bb Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Tue, 27 Oct 2026 11:56:09 +0000 Subject: [PATCH 2/8] Add check commands to `pr-checks/package.json` --- pr-checks/package.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pr-checks/package.json b/pr-checks/package.json index 343f94381..f96b919c1 100644 --- a/pr-checks/package.json +++ b/pr-checks/package.json @@ -2,6 +2,11 @@ "private": true, "description": "Dependencies for codeql-action scripts", "type": "module", + "scripts": { + "typecheck": "tsc --noEmit", + "test": "npx tsx --test", + "checks": "npm run typecheck && npm run test" + }, "dependencies": { "@actions/core": "^2.0.3", "@actions/github": "^8.0.1", From 405433cc6d34f0c9c57178fef0ff71433212695c Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Tue, 27 Oct 2026 11:56:52 +0000 Subject: [PATCH 3/8] Add `typecheck` command to `package.json` --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 76ac14cf2..31607ff78 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,8 @@ "test": "npm run ava -- src/", "test-debug": "npm run test -- --timeout=20m", "transpile": "tsc --build --verbose tsconfig.json", - "update-pr-checks": "./pr-checks/sync.sh" + "update-pr-checks": "./pr-checks/sync.sh", + "typecheck": "tsc --noEmit" }, "license": "MIT", "workspaces": [ From fe36f120dfa28d8c2fd951bf90ccac2dea5809dd Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Tue, 27 Oct 2026 11:57:35 +0000 Subject: [PATCH 4/8] Run `checks` command for `pr-checks` in CI --- .github/workflows/pr-checks.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index 5d2b1576f..ba6dfbcdb 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -126,10 +126,10 @@ jobs: if: ${{ !cancelled() && steps.install-deps.outcome == 'success' }} run: .github/workflows/script/verify-pr-checks.sh - - name: Run pr-checks tests + - name: Run pr-checks checks if: ${{ !cancelled() && steps.install-deps.outcome == 'success' }} working-directory: pr-checks - run: npx tsx --test + run: npm run checks - name: Run `pr-checks/changenotes.ts` to ensure that all unreleased change notes are valid if: ${{ !cancelled() && steps.install-deps.outcome == 'success' }} From 0aaf198c565dd3ffc69eff50b101ec42da89dc2a Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Fri, 30 Oct 2026 11:43:19 +0000 Subject: [PATCH 5/8] Seperate checks in `pr-checks.yml` --- .github/workflows/pr-checks.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index ba6dfbcdb..4736cef4a 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -126,10 +126,15 @@ jobs: if: ${{ !cancelled() && steps.install-deps.outcome == 'success' }} run: .github/workflows/script/verify-pr-checks.sh - - name: Run pr-checks checks + - name: Typecheck pr-checks scripts if: ${{ !cancelled() && steps.install-deps.outcome == 'success' }} working-directory: pr-checks - run: npm run checks + run: npm run typecheck + + - name: Run pr-checks tests + if: ${{ !cancelled() && steps.install-deps.outcome == 'success' }} + working-directory: pr-checks + run: npm run test - name: Run `pr-checks/changenotes.ts` to ensure that all unreleased change notes are valid if: ${{ !cancelled() && steps.install-deps.outcome == 'success' }} From a189728bdd709a4bf697869ed02bf3d538b77c51 Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Fri, 30 Oct 2026 16:37:57 +0000 Subject: [PATCH 6/8] Exclude more unused files in `tsconfig.json` --- pr-checks/tsconfig.json | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pr-checks/tsconfig.json b/pr-checks/tsconfig.json index 367148ab9..f75a95289 100644 --- a/pr-checks/tsconfig.json +++ b/pr-checks/tsconfig.json @@ -9,5 +9,12 @@ "noEmit": true }, "include": ["./**/*.ts", "../src/**/*.ts"], - "exclude": ["node_modules", "../src/**/*.test.ts"] + "exclude": [ + "node_modules", + "../src/testdata/**", + "../src/**/*.test.ts", + "../src/testing-utils.ts", + "../src/json/testing-util.ts", + "../src/feature-flags/testing-util.ts" + ] } From 0b97d537111f2ceccc660cfbdad7ce5be1b37f3a Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Fri, 30 Oct 2026 16:14:46 +0000 Subject: [PATCH 7/8] Extract zstd bundles using the tar path found by getTarVersion Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- lib/entry-points.js | 10 +++++----- src/tar.test.ts | 2 +- src/tar.ts | 12 +++++++----- src/tools-download.test.ts | 10 +++++----- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/lib/entry-points.js b/lib/entry-points.js index b2bb9c183..4e142c517 100644 --- a/lib/entry-points.js +++ b/lib/entry-points.js @@ -183682,13 +183682,13 @@ async function getTarVersion() { if (!match2?.[1]) { throw new Error("Failed to parse output of tar --version."); } - return { type: "gnu", version: match2[1] }; + return { type: "gnu", version: match2[1], path: tar }; } else if (stdout.includes("bsdtar")) { const match2 = stdout.match(/bsdtar ([0-9.]+)/); if (!match2?.[1]) { throw new Error("Failed to parse output of tar --version."); } - return { type: "bsd", version: match2[1] }; + return { type: "bsd", version: match2[1], path: tar }; } else { throw new Error("Unknown tar version"); } @@ -183755,10 +183755,10 @@ async function extractTarZst(tar, dest, tarVersion, logger2) { args.push("--overwrite"); } args.push("-f", tar instanceof stream.Readable ? "-" : tar, "-C", dest); - process.stdout.write(`[command]tar ${args.join(" ")} + process.stdout.write(`[command]${tarVersion.path} ${args.join(" ")} `); await new Promise((resolve15, reject) => { - const tarProcess = (0, import_child_process.spawn)("tar", args, { stdio: "pipe" }); + const tarProcess = (0, import_child_process.spawn)(tarVersion.path, args, { stdio: "pipe" }); let stdout = ""; tarProcess.stdout?.on("data", (data) => { stdout += data.toString(); @@ -183785,7 +183785,7 @@ async function extractTarZst(tar, dest, tarVersion, logger2) { if (code !== 0) { reject( new CommandInvocationError( - "tar", + tarVersion.path, args, code ?? void 0, stdout, diff --git a/src/tar.test.ts b/src/tar.test.ts index 99d68b531..e193b2df4 100644 --- a/src/tar.test.ts +++ b/src/tar.test.ts @@ -15,7 +15,7 @@ test("extractTarZst rejects if the input stream errors", async (t) => { const promise = extractTarZst( archive, path.join(tmpDir, "dest"), - { type: "gnu", version: "1.34" }, + { type: "gnu", version: "1.34", path: "tar" }, new RecordingLogger(), ); diff --git a/src/tar.ts b/src/tar.ts index 3a0d79cc6..4dd1c48be 100644 --- a/src/tar.ts +++ b/src/tar.ts @@ -17,6 +17,8 @@ const MIN_REQUIRED_GNU_TAR_VERSION = "1.31"; export type TarVersion = { type: "gnu" | "bsd"; version: string; + /** Path to the `tar` executable that reported this version. */ + path: string; }; async function getTarVersion(): Promise { @@ -39,14 +41,14 @@ async function getTarVersion(): Promise { throw new Error("Failed to parse output of tar --version."); } - return { type: "gnu", version: match[1] }; + return { type: "gnu", version: match[1], path: tar }; } else if (stdout.includes("bsdtar")) { const match = stdout.match(/bsdtar ([0-9.]+)/); if (!match?.[1]) { throw new Error("Failed to parse output of tar --version."); } - return { type: "bsd", version: match[1] }; + return { type: "bsd", version: match[1], path: tar }; } else { throw new Error("Unknown tar version"); } @@ -171,10 +173,10 @@ export async function extractTarZst( args.push("-f", tar instanceof stream.Readable ? "-" : tar, "-C", dest); - process.stdout.write(`[command]tar ${args.join(" ")}\n`); + process.stdout.write(`[command]${tarVersion.path} ${args.join(" ")}\n`); await new Promise((resolve, reject) => { - const tarProcess = spawn("tar", args, { stdio: "pipe" }); + const tarProcess = spawn(tarVersion.path, args, { stdio: "pipe" }); let stdout = ""; tarProcess.stdout?.on("data", (data: Buffer) => { @@ -210,7 +212,7 @@ export async function extractTarZst( if (code !== 0) { reject( new CommandInvocationError( - "tar", + tarVersion.path, args, code ?? undefined, stdout, diff --git a/src/tools-download.test.ts b/src/tools-download.test.ts index 1ba980bbe..928255d3c 100644 --- a/src/tools-download.test.ts +++ b/src/tools-download.test.ts @@ -70,7 +70,7 @@ test.serial( destination, undefined, {}, - { type: "gnu", version: "1.34" }, + { type: "gnu", version: "1.34", path: "tar" }, new RecordingLogger(), ); @@ -103,7 +103,7 @@ test.serial( destination, undefined, {}, - { type: "gnu", version: "1.34" }, + { type: "gnu", version: "1.34", path: "tar" }, new RecordingLogger(), ), { @@ -147,7 +147,7 @@ test.serial( destination, undefined, {}, - { type: "gnu", version: "1.34" }, + { type: "gnu", version: "1.34", path: "tar" }, new RecordingLogger(), ); @@ -187,7 +187,7 @@ test.serial( destination, undefined, {}, - { type: "gnu", version: "1.34" }, + { type: "gnu", version: "1.34", path: "tar" }, new RecordingLogger(), ); @@ -235,7 +235,7 @@ test.serial( path.join(tmpDir, "codeql"), undefined, {}, - { type: "gnu", version: "1.34" }, + { type: "gnu", version: "1.34", path: "tar" }, new RecordingLogger(), ); From 8512f45c1a3244f7f1f2c0f416734b06513a22ba Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Fri, 30 Oct 2026 17:10:42 +0000 Subject: [PATCH 8/8] Fix stdout and stderr being swapped in tar extraction errors Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- lib/entry-points.js | 4 ++-- src/tar.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/entry-points.js b/lib/entry-points.js index 4e142c517..d9d14db90 100644 --- a/lib/entry-points.js +++ b/lib/entry-points.js @@ -183788,8 +183788,8 @@ async function extractTarZst(tar, dest, tarVersion, logger2) { tarVersion.path, args, code ?? void 0, - stdout, - stderr + stderr, + stdout ) ); } diff --git a/src/tar.ts b/src/tar.ts index 4dd1c48be..3497da5e5 100644 --- a/src/tar.ts +++ b/src/tar.ts @@ -215,8 +215,8 @@ export async function extractTarZst( tarVersion.path, args, code ?? undefined, - stdout, stderr, + stdout, ), ); }