Skip to content

Workflow node typecheck

github-actions[bot] edited this page Nov 29, 2026 · 1 revision

node-typecheck

What it does. Installs a Node project's locked dependencies with install scripts off and runs the project's own TypeScript compiler over it. It is read-only and holds no secret.

Why it exists. A repository whose only Node code is a small module (an editor pane, a tooling script) does not need a full language CI, but it does need its types checked on every pull request. The check is the same for any such repository, and a merge watcher can accept a reusable workflow pinned by commit where it cannot read inline npm steps, so it lives here.

What it runs

Two commands, in this order, from working-directory:

npm ci --ignore-scripts --no-audit --no-fund
npx --no-install tsc -p .

They are not inputs. A caller cannot hand this workflow a command, so a pinned uses: of it is a unit that can be reviewed once. npm ci installs exactly what the lockfile says, with its integrity hashes, and runs no lifecycle script. --no-install makes a missing compiler a failure instead of a download, so typescript has to be in the lockfile.

What fails the job

  1. egress-policy that is not exactly audit or block.
  2. A working-directory that is absolute, has a .. segment, starts with - or uses a character outside letters, digits, ., _, - and /; a node-version that is not digits and dots.
  3. A missing or out-of-date lockfile (npm ci refuses), a dependency that resolves outside registry.npmjs.org, or a type error.

The egress list

Fixed, with no extension input: github.com and api.github.com for the checkout, registry.npmjs.org for npm ci, and the runner's results receiver. Node itself comes from the GitHub-hosted image's tool cache (actions/setup-node with package-manager-cache: false), so node-version must be a version the image carries; one that needs a download is blocked and the job fails instead of widening the list.

A minimal caller

jobs:
  typecheck:
    uses: ChiefGyk3D/git-your-ship-together/.github/workflows/node-typecheck.yml@<sha> # vX.Y.Z
    permissions:
      contents: read
    with:
      working-directory: mods/claude-fafo

Add the job to the needs of your own CI green gate.

Inputs (5), read from node-typecheck.yml:

Input Type Default Meaning
working-directory string . Repository-relative directory holding package.json, the lockfile and tsconfig.json. Letters, digits, ., _, - and / only; no leading / and no .. segment. . is the repository root.
node-version string 22 Node major or exact version for actions/setup-node, e.g. 22 or 22.23.5. It must already be in the GitHub-hosted runner's tool cache (the egress list allows no Node download). Digits and dots only.
egress-policy string block Accepted so a caller can pass the same egress inputs to every workflow here, and validated (exactly audit or block). It changes nothing in this workflow, whose one job holds no secret and so follows egress-policy-secretless.
egress-policy-secretless string block harden-runner egress policy for this job, which holds no stored secret, no OIDC token and no write-scoped token (read-only contents) - audit logs outbound connections, block allows only the fixed allow-list. Exactly audit or block; any other value fails the job. Defaults to block (EX-0001 is closed); audit takes effect on GitHub-hosted runners only.
timeout-minutes number 10 Job timeout.

What it refuses to do

  • It runs no command a caller supplies: there is no input that reaches a shell line, only the two fixed commands above.
  • It runs no install script (--ignore-scripts) and never fetches a compiler that is not in the lockfile (--no-install).
  • It allows no host beyond github.com, api.github.com, registry.npmjs.org and the results receiver, and has no input to add one.
  • It accepts no working directory that is absolute, climbs with .. or holds characters outside letters, digits, ., _, - and /.
  • It holds no secret and no token beyond the read-only contents: read job token, and the checkout does not persist it.

Clone this wiki locally