From 97c27c3c5be1e5112fbde4c765a9e6894b3f3fcb Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Tue, 11 Aug 2026 00:43:17 +0100 Subject: [PATCH 1/5] editorconfig: indent TS the same as JS (cherry picked from commit ca4d49e1ddd28ea31088ce5ab31544c732c70c3d) --- .editorconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.editorconfig b/.editorconfig index 3a2159d33734..4f4cde184f5d 100644 --- a/.editorconfig +++ b/.editorconfig @@ -23,15 +23,15 @@ insert_final_newline = false # see https://nixos.org/nixpkgs/manual/#chap-conventions -[*.{bash,css,js,json,lock,md,nix,pl,pm,py,rb,sh,xml}] +[*.{bash,css,js,json,lock,md,nix,pl,pm,py,rb,sh,ts,xml}] indent_style = space # Match docbook files, set indent width of one [*.xml] indent_size = 1 -# Match json/lockfiles/markdown/nix/ruby files, set indent width of two -[*.{js,json,lock,md,nix,rb}] +# Match js/json/lockfiles/markdown/nix/ruby/ts files, set indent width of two +[*.{js,json,lock,md,nix,rb,ts}] indent_size = 2 # Match all the Bash code in Nix files, set indent width of two From ca4cf44ba58ce73a8e606e757acd05a1cf58694c Mon Sep 17 00:00:00 2001 From: Michael Daniels Date: Sat, 8 Aug 2026 10:14:40 -0400 Subject: [PATCH 2/5] ci/github-script/.gitignore: add comparison artifact Needed by check-target-branch. (cherry picked from commit 78df5b944fe7930dd6fee5d247b5811748050eda) --- ci/github-script/.gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci/github-script/.gitignore b/ci/github-script/.gitignore index 6b8a37657bc7..33a8fb974c64 100644 --- a/ci/github-script/.gitignore +++ b/ci/github-script/.gitignore @@ -1,2 +1,4 @@ +comparison +comparison.zip node_modules step-summary.md From e34052828ca4068799e49963af6151336a9421d2 Mon Sep 17 00:00:00 2001 From: Michael Daniels Date: Sat, 8 Aug 2026 10:16:37 -0400 Subject: [PATCH 3/5] ci/github-script/run: correct variable name (cherry picked from commit 578ac009585ba14c32c7f490d24ce462b5a7f615) --- ci/github-script/run | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/github-script/run b/ci/github-script/run index 1ac5075dab1b..522a4dbebbdd 100755 --- a/ci/github-script/run +++ b/ci/github-script/run @@ -112,8 +112,8 @@ program .argument('', 'Name of the GitHub repository to run on (Example: nixpkgs)') .argument('', 'Number of the Pull Request to run on') .action(async (owner, repo, pr, options) => { - const checkCommitMessages = (await import('./check-target-branch.js')).default - await run(checkCommitMessages, owner, repo, pr, options) + const checkTargetBranch = (await import('./check-target-branch.js')).default + await run(checkTargetBranch, owner, repo, pr, options) }) program From 8e8424fbf02b964e0a48adee0bd1e1d54471b6ce Mon Sep 17 00:00:00 2001 From: Michael Daniels Date: Sat, 8 Aug 2026 10:17:52 -0400 Subject: [PATCH 4/5] ci/github-script: check types by default (cherry picked from commit 7045e3afe12582bf7f9055c0338272946e02dd38) --- ci/github-script/bot.js | 1 + ci/github-script/check-target-branch.js | 2 - ci/github-script/commits.js | 1 + ci/github-script/get-pr-commit-details.js | 6 +- ci/github-script/get-teams.js | 1 + ci/github-script/lint-commits.js | 9 +- ci/github-script/manual-file-edits.js | 5 +- ci/github-script/merge.js | 1 + ci/github-script/package-lock.json | 395 +++++++++++++++++++++- ci/github-script/package.json | 5 + ci/github-script/prepare.js | 1 + ci/github-script/reviewers.js | 1 + ci/github-script/reviews.js | 10 +- ci/github-script/supportedSystems.js | 1 + ci/github-script/tsconfig.json | 26 ++ ci/github-script/withRateLimit.js | 1 + ci/supportedBranches.js | 1 + 17 files changed, 442 insertions(+), 25 deletions(-) create mode 100644 ci/github-script/tsconfig.json diff --git a/ci/github-script/bot.js b/ci/github-script/bot.js index 684e3e33179a..bdd304a5ac97 100644 --- a/ci/github-script/bot.js +++ b/ci/github-script/bot.js @@ -1,3 +1,4 @@ +// @ts-nocheck module.exports = async ({ github, context, core, dry }) => { const path = require('node:path') const { DefaultArtifactClient } = await import('@actions/artifact') diff --git a/ci/github-script/check-target-branch.js b/ci/github-script/check-target-branch.js index 17b857e55697..6e2e449eb6ea 100644 --- a/ci/github-script/check-target-branch.js +++ b/ci/github-script/check-target-branch.js @@ -1,5 +1,3 @@ -/// @ts-check - // TODO: should this be combined with the branch checks in prepare.js? // They do seem quite similar, but this needs to run after eval, // and prepare.js obviously doesn't. diff --git a/ci/github-script/commits.js b/ci/github-script/commits.js index 56873c158af4..1235f0b8619f 100644 --- a/ci/github-script/commits.js +++ b/ci/github-script/commits.js @@ -1,3 +1,4 @@ +// @ts-nocheck module.exports = async ({ github, context, core, dry, cherryPicks }) => { const { execFileSync } = require('node:child_process') const { classify } = require('../supportedBranches.js') diff --git a/ci/github-script/get-pr-commit-details.js b/ci/github-script/get-pr-commit-details.js index b268e7cf6202..e1caed1c1555 100644 --- a/ci/github-script/get-pr-commit-details.js +++ b/ci/github-script/get-pr-commit-details.js @@ -1,4 +1,4 @@ -// @ts-check +// @ts-nocheck const { promisify } = require('node:util') const execFile = promisify(require('node:child_process').execFile) @@ -16,7 +16,7 @@ const execFile = promisify(require('node:child_process').execFile) /** * @param {{ * args: string[] - * core: import('@actions/core'), + * core: typeof import('@actions/core'), * quiet?: boolean, * repoPath?: string, * }} RunGitProps @@ -40,7 +40,7 @@ async function runGit({ args, repoPath, core, quiet }) { * of 250 commits and doesn't return the changed files. * * @param {{ - * core: import('@actions/core'), + * core: typeof import('@actions/core'), * pr: Awaited["rest"]["pulls"]["get"]>>["data"] * repoPath?: string, * }} GetCommitMessagesForPRProps diff --git a/ci/github-script/get-teams.js b/ci/github-script/get-teams.js index 0a097d23eb2f..403250525290 100644 --- a/ci/github-script/get-teams.js +++ b/ci/github-script/get-teams.js @@ -1,3 +1,4 @@ +// @ts-nocheck const excludeTeams = [ /^voters.*$/, /^nixpkgs-maintainers$/, diff --git a/ci/github-script/lint-commits.js b/ci/github-script/lint-commits.js index 51c81332490d..ec51d0e281c5 100644 --- a/ci/github-script/lint-commits.js +++ b/ci/github-script/lint-commits.js @@ -1,4 +1,3 @@ -// @ts-check const { classify } = require('../supportedBranches.js') const { getCommitDetailsForPR } = require('./get-pr-commit-details.js') @@ -6,9 +5,9 @@ const { getCommitDetailsForPR } = require('./get-pr-commit-details.js') /** * @param {{ - * github: InstanceType, + * github: InstanceType, * context: typeof import('@actions/github').context, - * core: import('@actions/core'), + * core: typeof import('@actions/core'), * repoPath?: string, * }} LintCommitsProps */ @@ -57,7 +56,7 @@ async function lintCommits({ github, context, core, repoPath }) { /** * @param {{ * commits: Commit[], - * core: import('@actions/core'), + * core: typeof import('@actions/core'), * }} CheckCommitMessagesProps */ async function checkCommitMessages({ commits, core }) { @@ -170,7 +169,7 @@ async function checkCommitMessages({ commits, core }) { /** * @param {{ * commits: Commit[], - * core: import('@actions/core'), + * core: typeof import('@actions/core'), * }} CheckGitFieldsProps */ async function checkCommitMetadata({ commits, core }) { diff --git a/ci/github-script/manual-file-edits.js b/ci/github-script/manual-file-edits.js index 625979c35cc1..2c10b090e9e2 100644 --- a/ci/github-script/manual-file-edits.js +++ b/ci/github-script/manual-file-edits.js @@ -1,12 +1,11 @@ -// @ts-check const { classify } = require('../supportedBranches.js') const { getCommitDetailsForPR } = require('./get-pr-commit-details') /** * @param {{ - * github: InstanceType, + * github: InstanceType, * context: typeof import('@actions/github').context, - * core: import('@actions/core'), + * core: typeof import('@actions/core'), * repoPath?: string, * dry: boolean, * }} CheckManualFileEditsProps diff --git a/ci/github-script/merge.js b/ci/github-script/merge.js index 180a12b0fe4a..d0538e4a26ba 100644 --- a/ci/github-script/merge.js +++ b/ci/github-script/merge.js @@ -1,3 +1,4 @@ +// @ts-nocheck const { classify } = require('../supportedBranches.js') function runChecklist({ diff --git a/ci/github-script/package-lock.json b/ci/github-script/package-lock.json index a557931231b6..f9defdcf8f89 100644 --- a/ci/github-script/package-lock.json +++ b/ci/github-script/package-lock.json @@ -10,6 +10,11 @@ "@actions/github": "9.1.0", "bottleneck": "2.19.5", "commander": "14.0.3" + }, + "devDependencies": { + "@tsconfig/node24": "24.0.4", + "@types/node": "24.13.3", + "typescript": "7.0.2" } }, "node_modules/@actions/artifact": { @@ -588,6 +593,19 @@ "protoc-gen-ts": "bin/protoc-gen-ts" } }, + "node_modules/@protobuf-ts/plugin/node_modules/typescript": { + "version": "3.9.10", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz", + "integrity": "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==", + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, "node_modules/@protobuf-ts/protoc": { "version": "2.11.1", "resolved": "https://registry.npmjs.org/@protobuf-ts/protoc/-/protoc-2.11.1.tgz", @@ -612,6 +630,343 @@ "@protobuf-ts/runtime": "^2.11.1" } }, + "node_modules/@tsconfig/node24": { + "version": "24.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node24/-/node24-24.0.4.tgz", + "integrity": "sha512-2A933l5P5oCbv6qSxHs7ckKwobs8BDAe9SJ/Xr2Hy+nDlwmLE1GhFh/g/vXGRZWgxBg9nX/5piDtHR9Dkw/XuA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "24.13.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.13.3.tgz", + "integrity": "sha512-Dh8vAsV36ig5wa9OX4pXvMc9D3Veibfw2wix0CUwYODLD8nkj9UsLjASr49nPg+2eKzxhBV+v7L8pXvT4e639Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~7.18.0" + } + }, + "node_modules/@typescript/typescript-aix-ppc64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-aix-ppc64/-/typescript-aix-ppc64-7.0.2.tgz", + "integrity": "sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ==", + "cpu": [ + "ppc64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-darwin-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-darwin-arm64/-/typescript-darwin-arm64-7.0.2.tgz", + "integrity": "sha512-gowzar9MwS/aRWp6f3a4KUqzRjAZjOsmGNCM6LcTgXum+dBfgsBVMN+AgvOCCbguXyick6LJhpBszxMebJ8syA==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-darwin-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-darwin-x64/-/typescript-darwin-x64-7.0.2.tgz", + "integrity": "sha512-SZ9xZInqApNlNGc9s0W1VSsktYSOe9cFqNOIqmN1Gs8SmkjKZYFt017G4VwPxASInODuAdbTW7sXiFUf893RgA==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-freebsd-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-freebsd-arm64/-/typescript-freebsd-arm64-7.0.2.tgz", + "integrity": "sha512-W5NH4y/J0plIIS5b2xvTEkU7JFxyqdMAOgf+Ilhl0vHQXKO5dZoxd+C/jEtq56c4F3wk71RB4BMRQ2XdI+bwYQ==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-freebsd-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-freebsd-x64/-/typescript-freebsd-x64-7.0.2.tgz", + "integrity": "sha512-UMGDx5sTpzNw3WiPebH7l90IWfJggEd+egHt/q6p7/Cm3zqoV7VxkGXt+3DxPIw8CcmvAB0j3sVVfbhX+M4Tpw==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-arm": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-arm/-/typescript-linux-arm-7.0.2.tgz", + "integrity": "sha512-gffT3xPz9sR7j/YJExkyPntrI0P2EP9XbOyWzth2/Gs0RstK+90RBcO0ncXoXy/beYll1SXw846Nf2zdnEz0QQ==", + "cpu": [ + "arm" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-arm64/-/typescript-linux-arm64-7.0.2.tgz", + "integrity": "sha512-Qh4eU4/y3yDjnfjjyPYihMj5/ODIlmt+Bzu17OI+fiSRDW57QmU5SiN63exPRNJPKUzcc1INa1NXdrJ+MqHjUQ==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-loong64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-loong64/-/typescript-linux-loong64-7.0.2.tgz", + "integrity": "sha512-uEHck9i8hoAzXPiYRib1O7miOnz23SxIeVl6F4LXox+qov1K35jHcEW6VHKvZI+pyvl7fZEP4MCU5LYvIq1GuQ==", + "cpu": [ + "loong64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-mips64el": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-mips64el/-/typescript-linux-mips64el-7.0.2.tgz", + "integrity": "sha512-R4KvAMnE43W5Qeqb0Ly56O3mWMWIAgsMyz36DCaycd5nbg/9kzm0liw3JocfRqyJY0KPmzFjbswozXyW0DnIYA==", + "cpu": [ + "mips64el" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-ppc64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-ppc64/-/typescript-linux-ppc64-7.0.2.tgz", + "integrity": "sha512-DORx5b3sd/4S7eayxm4FQv+A7CrkUIGRaHiwI8oiHTAI1fAPWhF4J0vAlkC8biAlHSVVwxMQ3tjZ2/DVbnQiiA==", + "cpu": [ + "ppc64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-riscv64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-riscv64/-/typescript-linux-riscv64-7.0.2.tgz", + "integrity": "sha512-wf0jqEDOjrPRnKwYRyyJDRo11KMbvMFrU+q4zqKyChODBzvlkbhNQfKvLxQCcwTpdDaXSHZTVuh0JoCrKCUMHQ==", + "cpu": [ + "riscv64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-s390x": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-s390x/-/typescript-linux-s390x-7.0.2.tgz", + "integrity": "sha512-IkwJc3L7yhytWd/ewjyxNDfOmswCm9GWMJT/ue/dU4aZNbwZeYAetq42VyLmsmSjvoX7z74X6ZaYCtzAr0EuGw==", + "cpu": [ + "s390x" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-x64/-/typescript-linux-x64-7.0.2.tgz", + "integrity": "sha512-EYdf2cNg7rgCWJnxCdJ+F3V39O8ihb37eHAu1LK8oAFizgTQbPOK7zHHXbPt8rX24COqODXeI3sIf0fCXG7H/A==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-netbsd-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-netbsd-arm64/-/typescript-netbsd-arm64-7.0.2.tgz", + "integrity": "sha512-+polYF4MF04aPpO5FTkHran9yUQDSXqy5GiSDKpsll5jy3l3+g9QLhpf39T+ePtefhXLOGrLl0QIjkQP6VnelA==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-netbsd-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-netbsd-x64/-/typescript-netbsd-x64-7.0.2.tgz", + "integrity": "sha512-8YIT0EHM/3dq10ZOVF/A7pc/YSMtbcecct4rWtexrnSCHOPcpC2KTLXfTCR6vDpnSiY12heNb1GiN/wu+T/FyA==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-openbsd-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-openbsd-arm64/-/typescript-openbsd-arm64-7.0.2.tgz", + "integrity": "sha512-APT8+ClYnuYm1u9+kgGXoMj2VzWzcymwh2gNSQVySHfkRDGOTVkoWLjCmOQSaO+PoqQ57B0flRp9SA+7GnnkzQ==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-openbsd-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-openbsd-x64/-/typescript-openbsd-x64-7.0.2.tgz", + "integrity": "sha512-yX7s+Q0Dln0Dt9tEzZsAjXXR/+ytBM7AlglaqyeMPxQszJ1JhlJdZ6jLA+IzldHtflX81em7lDao1xXu+aRRkg==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-sunos-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-sunos-x64/-/typescript-sunos-x64-7.0.2.tgz", + "integrity": "sha512-dLJDGaLZ1D4HPQn62u1n8mBDkJREwMsAkCdkwd4Ieqw+x3TUyTsqY0YiBCtE6H6OzzgGk3iuZ3vFWRS+E8/d1g==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-win32-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-win32-arm64/-/typescript-win32-arm64-7.0.2.tgz", + "integrity": "sha512-Gyl1Vy6OsWesLzmq+EP0Fb7b4Nid5232AvcA2SFcdYreldpNtYFFofPjnt62y9hQy7VTaZp65ICJjuAQRaVcIQ==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-win32-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-win32-x64/-/typescript-win32-x64-7.0.2.tgz", + "integrity": "sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=16.20.0" + } + }, "node_modules/@typescript/vfs": { "version": "1.6.1", "resolved": "https://registry.npmjs.org/@typescript/vfs/-/vfs-1.6.1.tgz", @@ -1657,16 +2012,37 @@ } }, "node_modules/typescript": { - "version": "3.9.10", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz", - "integrity": "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-7.0.2.tgz", + "integrity": "sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA==", "license": "Apache-2.0", "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" + "tsc": "bin/tsc" }, "engines": { - "node": ">=4.2.0" + "node": ">=16.20.0" + }, + "optionalDependencies": { + "@typescript/typescript-aix-ppc64": "7.0.2", + "@typescript/typescript-darwin-arm64": "7.0.2", + "@typescript/typescript-darwin-x64": "7.0.2", + "@typescript/typescript-freebsd-arm64": "7.0.2", + "@typescript/typescript-freebsd-x64": "7.0.2", + "@typescript/typescript-linux-arm": "7.0.2", + "@typescript/typescript-linux-arm64": "7.0.2", + "@typescript/typescript-linux-loong64": "7.0.2", + "@typescript/typescript-linux-mips64el": "7.0.2", + "@typescript/typescript-linux-ppc64": "7.0.2", + "@typescript/typescript-linux-riscv64": "7.0.2", + "@typescript/typescript-linux-s390x": "7.0.2", + "@typescript/typescript-linux-x64": "7.0.2", + "@typescript/typescript-netbsd-arm64": "7.0.2", + "@typescript/typescript-netbsd-x64": "7.0.2", + "@typescript/typescript-openbsd-arm64": "7.0.2", + "@typescript/typescript-openbsd-x64": "7.0.2", + "@typescript/typescript-sunos-x64": "7.0.2", + "@typescript/typescript-win32-arm64": "7.0.2", + "@typescript/typescript-win32-x64": "7.0.2" } }, "node_modules/undici": { @@ -1681,6 +2057,13 @@ "node": ">=14.0" } }, + "node_modules/undici-types": { + "version": "7.18.2", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.18.2.tgz", + "integrity": "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w==", + "dev": true, + "license": "MIT" + }, "node_modules/universal-user-agent": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-7.0.3.tgz", diff --git a/ci/github-script/package.json b/ci/github-script/package.json index b5fb5e4a586a..bba0431f80e2 100644 --- a/ci/github-script/package.json +++ b/ci/github-script/package.json @@ -10,5 +10,10 @@ "@actions/github": "9.1.0", "bottleneck": "2.19.5", "commander": "14.0.3" + }, + "devDependencies": { + "@tsconfig/node24": "24.0.4", + "@types/node": "24.13.3", + "typescript": "7.0.2" } } diff --git a/ci/github-script/prepare.js b/ci/github-script/prepare.js index 7543374dfaa6..03ac37c2f724 100644 --- a/ci/github-script/prepare.js +++ b/ci/github-script/prepare.js @@ -1,3 +1,4 @@ +// @ts-nocheck const { classify } = require('../supportedBranches.js') const { postReview, dismissReviews } = require('./reviews.js') const reviewKey = 'prepare' diff --git a/ci/github-script/reviewers.js b/ci/github-script/reviewers.js index be458ba4eb32..983ae3003eb9 100644 --- a/ci/github-script/reviewers.js +++ b/ci/github-script/reviewers.js @@ -1,3 +1,4 @@ +// @ts-nocheck async function handleReviewers({ github, context, diff --git a/ci/github-script/reviews.js b/ci/github-script/reviews.js index 80e250cfa7c3..370b8e0656ef 100644 --- a/ci/github-script/reviews.js +++ b/ci/github-script/reviews.js @@ -1,5 +1,3 @@ -// @ts-check - const eventToState = { COMMENT: 'COMMENTED', REQUEST_CHANGES: 'CHANGES_REQUESTED', @@ -16,7 +14,7 @@ const reviewUsers = [ ] /** - * @typedef {InstanceType} GitHub + * @typedef {InstanceType} GitHub * @typedef {typeof import('@actions/github').context} Context * * @typedef {Awaited>['data'][number]} Review @@ -27,7 +25,7 @@ const reviewUsers = [ * @param {{ * github: GitHub, * context: Context, - * core: import('@actions/core'), + * core: typeof import('@actions/core'), * dry: boolean, * reviewKey?: string, * }} DismissReviewsProps @@ -165,10 +163,10 @@ async function dismissReviews({ github, context, core, dry, reviewKey }) { * @param {{ * github: GitHub, * context: Context, - * core: import('@actions/core'), + * core: typeof import('@actions/core'), * dry: boolean, * body: string, - * event: keyof eventToState, + * event: keyof typeof eventToState, * reviewKey: string, * }} PostReviewProps */ diff --git a/ci/github-script/supportedSystems.js b/ci/github-script/supportedSystems.js index 2f7a762a0d05..9776f3b796a2 100644 --- a/ci/github-script/supportedSystems.js +++ b/ci/github-script/supportedSystems.js @@ -1,3 +1,4 @@ +// @ts-nocheck module.exports = async ({ github, context, targetSha }) => { const { content, encoding } = ( await github.rest.repos.getContent({ diff --git a/ci/github-script/tsconfig.json b/ci/github-script/tsconfig.json new file mode 100644 index 000000000000..867c9169f9fe --- /dev/null +++ b/ci/github-script/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "lib": [ + "es2024", + "ESNext.Array", + "ESNext.Collection", + "ESNext.Error", + "ESNext.Iterator", + "ESNext.Promise" + ], + "module": "nodenext", + "target": "es2024", + + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "moduleResolution": "node16", + + "allowImportingTsExtensions": true, + "allowJs": true, + "checkJs": true, + "erasableSyntaxOnly": true, + "verbatimModuleSyntax": true, + "noEmit": true, + } +} diff --git a/ci/github-script/withRateLimit.js b/ci/github-script/withRateLimit.js index d1b1c756ea09..c5bcdc5984c7 100644 --- a/ci/github-script/withRateLimit.js +++ b/ci/github-script/withRateLimit.js @@ -1,3 +1,4 @@ +// @ts-nocheck module.exports = async ({ github, core, maxConcurrent = 1 }, callback) => { const Bottleneck = require('bottleneck') diff --git a/ci/supportedBranches.js b/ci/supportedBranches.js index 2f4bf5abfb40..5f25b99bbfc3 100755 --- a/ci/supportedBranches.js +++ b/ci/supportedBranches.js @@ -2,6 +2,7 @@ /* #!nix-shell -i node -p nodejs */ +// @ts-nocheck const typeConfig = { master: ['development', 'primary'], From e23bb18fa9e376dc42d0b9be9a84e6af08eed868 Mon Sep 17 00:00:00 2001 From: Michael Daniels Date: Sat, 8 Aug 2026 10:22:59 -0400 Subject: [PATCH 5/5] ci/github-script/check-target-branch: convert to TypeScript Only doing this one for now as a proof-of-concept. (cherry picked from commit 2496d47b76de79baeed8543a9a9b22d3a45807e9) --- .github/workflows/eval.yml | 2 +- .github/workflows/test.yml | 2 +- ...arget-branch.js => check-target-branch.ts} | 80 +++++++++++-------- ci/github-script/run | 2 +- 4 files changed, 49 insertions(+), 37 deletions(-) rename ci/github-script/{check-target-branch.js => check-target-branch.ts} (87%) diff --git a/.github/workflows/eval.yml b/.github/workflows/eval.yml index eee506a87165..4bed665957f5 100644 --- a/.github/workflows/eval.yml +++ b/.github/workflows/eval.yml @@ -375,7 +375,7 @@ jobs: with: github-token: ${{ steps.app-token.outputs.token || github.token }} script: | - require('./nixpkgs/trusted/ci/github-script/check-target-branch.js')({ + require('./nixpkgs/trusted/ci/github-script/check-target-branch.ts')({ github, context, core, diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 46a399cb7752..fac0be466bb8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -77,7 +77,7 @@ jobs: '.github/workflows/pull-request-target.yml', '.github/workflows/test.yml', 'ci/github-script/bot.js', - 'ci/github-script/check-target-branch.js', + 'ci/github-script/check-target-branch.ts', 'ci/github-script/commits.js', 'ci/github-script/get-pr-commit-details.js', 'ci/github-script/lint-commits.js', diff --git a/ci/github-script/check-target-branch.js b/ci/github-script/check-target-branch.ts similarity index 87% rename from ci/github-script/check-target-branch.js rename to ci/github-script/check-target-branch.ts index 6e2e449eb6ea..1b1f2c4e8b03 100644 --- a/ci/github-script/check-target-branch.js +++ b/ci/github-script/check-target-branch.ts @@ -1,3 +1,7 @@ +import type * as actionsCore from '@actions/core' +import type { context as actionsContext } from '@actions/github' +import type { GitHub } from '@actions/github/lib/utils' + // TODO: should this be combined with the branch checks in prepare.js? // They do seem quite similar, but this needs to run after eval, // and prepare.js obviously doesn't. @@ -7,39 +11,47 @@ const { readFile } = require('node:fs/promises') const { postReview, dismissReviews } = require('./reviews.js') const reviewKey = 'check-target-branch' -/** - * @param {{ - * github: InstanceType, - * context: typeof import('@actions/github').context - * core: import('@actions/core') - * dry: boolean - * }} CheckTargetBranchProps - */ -async function checkTargetBranch({ github, context, core, dry }) { - /** - * @type {{ - * attrdiff: { - * added: string[], - * changed: string[], - * removed: string[], - * }, - * attrdiffByKernel: Record, - * attrdiffByPlatform: Record, - * labels: Record, - * rebuildCountByKernel: Record, - * rebuildsByKernel: Record, - * rebuildsByPlatform: Record, - * }} - */ - const changed = JSON.parse( + +type ChangedPaths = { + attrdiff: { + added: string[] + changed: string[] + removed: string[] + } + attrdiffByKernel: Record< + string, + { + added: string[] + changed: string[] + removed: string[] + } + > + attrdiffByPlatform: Record< + string, + { + added: string[] + changed: string[] + removed: string[] + } + > + labels: Record + rebuildCountByKernel: Record + rebuildsByKernel: Record + rebuildsByPlatform: Record +} + +async function checkTargetBranch({ + github, + context, + core, + dry, +}: { + github: InstanceType + context: typeof actionsContext + core: typeof actionsCore + dry: boolean +}) { + const changed: ChangedPaths = JSON.parse( await readFile('comparison/changed-paths.json', 'utf-8'), ) const pull_number = context.payload.pull_request?.number @@ -153,7 +165,7 @@ async function checkTargetBranch({ github, context, core, dry }) { reviewKey, }) } else if (rebuildsAllTests && !isExemptKernelUpdate) { - let branchText + let branchText: string if (base === 'master' && maxRebuildCount >= 500) { branchText = '(probably either `staging-nixos` or `staging`)' } else if (base === 'master') { diff --git a/ci/github-script/run b/ci/github-script/run index 522a4dbebbdd..51ba00cc0d39 100755 --- a/ci/github-script/run +++ b/ci/github-script/run @@ -112,7 +112,7 @@ program .argument('', 'Name of the GitHub repository to run on (Example: nixpkgs)') .argument('', 'Number of the Pull Request to run on') .action(async (owner, repo, pr, options) => { - const checkTargetBranch = (await import('./check-target-branch.js')).default + const checkTargetBranch = (await import('./check-target-branch.ts')).default await run(checkTargetBranch, owner, repo, pr, options) })