-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
ci: typecheck github-script code #485846
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
base: master
Are you sure you want to change the base?
ci: typecheck github-script code #485846
Changes from all commits
746095d
f0b8466
91edfab
afe7522
e6b4792
c26c785
1227412
3972dae
061da85
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 | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,44 @@ | ||||||
| # Type check the CI scripts in ci/github-script using TypeScript | ||||||
| { | ||||||
| importNpmLock, | ||||||
| nodejs, | ||||||
| runCommand, | ||||||
| writeShellScriptBin, | ||||||
| }: | ||||||
| let | ||||||
| npmDeps = importNpmLock.buildNodeModules { | ||||||
| npmRoot = ./.; | ||||||
| inherit nodejs; | ||||||
|
Member
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.
Suggested change
|
||||||
| }; | ||||||
|
|
||||||
| # Files from ci/ that are referenced by the scripts | ||||||
| parentFiles = { | ||||||
| "supportedBranches.js" = ../supportedBranches.js; | ||||||
| "supportedSystems.json" = ../supportedSystems.json; | ||||||
| }; | ||||||
| in | ||||||
| runCommand "typecheck-ci-scripts" | ||||||
| { | ||||||
| nativeBuildInputs = [ nodejs ]; | ||||||
|
Member
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.
Suggested change
|
||||||
| passthru.driver = writeShellScriptBin "typecheck-ci-scripts" '' | ||||||
| nix-build --no-out-link "$@" \ | ||||||
| ${toString ./..} -A typecheck-ci-scripts | ||||||
| ''; | ||||||
| } | ||||||
| '' | ||||||
| # Set up directory structure matching the source layout | ||||||
| mkdir -p github-script | ||||||
| cp -r ${./.}/* github-script/ | ||||||
| chmod -R u+w github-script | ||||||
| ln -s ${npmDeps}/node_modules github-script/node_modules | ||||||
|
|
||||||
| # Copy files from ci/ that are referenced by the scripts | ||||||
| ${builtins.concatStringsSep "\n" ( | ||||||
| builtins.attrValues (builtins.mapAttrs (name: path: "cp ${path} ${name}") parentFiles) | ||||||
| )} | ||||||
|
|
||||||
| cd github-script | ||||||
| node node_modules/typescript/bin/tsc --project jsconfig.json | ||||||
| echo "typecheck-ci-scripts: ok" | ||||||
| touch $out | ||||||
| '' | ||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,16 @@ | ||||||||||||||||||||
| { | ||||||||||||||||||||
| "compilerOptions": { | ||||||||||||||||||||
| "checkJs": true, | ||||||||||||||||||||
| "allowJs": true, | ||||||||||||||||||||
| "noEmit": true, | ||||||||||||||||||||
| "target": "ES2024", | ||||||||||||||||||||
| "lib": ["ESNext"], | ||||||||||||||||||||
|
Member
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. Per https://github.com/tsconfig/bases/blob/main/bases/node24.json:
Suggested change
|
||||||||||||||||||||
| "module": "commonjs", | ||||||||||||||||||||
| "moduleResolution": "node", | ||||||||||||||||||||
| "resolveJsonModule": true, | ||||||||||||||||||||
| "strict": false, | ||||||||||||||||||||
| "skipLibCheck": true | ||||||||||||||||||||
| }, | ||||||||||||||||||||
| "include": ["*.js"], | ||||||||||||||||||||
| "exclude": ["node_modules"] | ||||||||||||||||||||
| } | ||||||||||||||||||||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,10 +1,17 @@ | ||||||
| { | ||||||
| "private": true, | ||||||
| "scripts": { | ||||||
| "typecheck": "tsc --project jsconfig.json" | ||||||
| }, | ||||||
| "dependencies": { | ||||||
| "@actions/artifact": "2.3.2", | ||||||
| "@actions/core": "1.11.1", | ||||||
| "@actions/github": "6.0.1", | ||||||
| "bottleneck": "2.19.5", | ||||||
| "commander": "14.0.0" | ||||||
| }, | ||||||
| "devDependencies": { | ||||||
| "@types/node": "^22.0.0", | ||||||
|
Member
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. Node 24 is used by the github-script action, and is the current version of package-lock.json will also need to be updated, of course.
Suggested change
|
||||||
| "typescript": "^5.7.0" | ||||||
| } | ||||||
| } | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nodejsonmasteris v24, but v22 on stable.