[TASK] Add reusable Node command workflow#15
Conversation
c57a5c2 to
5b31aca
Compare
95182f8 to
4479217
Compare
Shared workflow for Node.js-based checks (install + run command), mirroring the structure of reusable-php-command.yml. First consumer: the theme-js-tests job in render-guides. Signed-off-by: Sebastian Mendel <github@sebastianmendel.de>
4479217 to
9f4ae93
Compare
|
Thanks for the work here. I understand the goal of keeping CI patterns consistent, but at the moment I do not see enough benefit for a dedicated reusable Node workflow. As far as I know, the only Node usage in the TYPO3 Documentation org is the render-guides theme asset/test job. That job is currently small and explicit: checkout, setup Node from .nvmrc, install with npm ci, and run npm test. For a single consumer, a generic reusable workflow adds abstraction and maintenance surface without really removing duplication. The extra flexibility for cache modes, package managers, install commands, and generic command execution looks useful only if we expect more Node consumers. My preference would be to keep the Node job inline in render-guides for now and revisit this once we have at least a second real consumer or repeated Node CI logic. |
|
@linawolf I see your points, and I had similar thoughts. Let me explain why I still opened this PR: IMO, consistency is often more valuable than avoiding a few extra lines of code. Maintenance burden also cannot be measured by lines of code alone. Another reason for this move is to avoid spreading CI patterns and external action usage across multiple repositories. From a security and governance perspective, having one reviewed central place as the gatekeeper makes this easier to control and maintain. But as I wrote: your points are valid, and I think mine are too. So I’m afraid the hard part is now yours: deciding which side weighs more. Sorry. ;-) |
Summary
Adds
reusable-node-command.yml— a shared workflow for Node.js-based checks, mirroring the structure ofreusable-php-command.yml(checkout → set up runtime → cached install → run command).There is currently no Node/JS reusable in this repository, which is why JS test jobs in consumer repos stay inline — e.g. the
theme-js-testsjob in TYPO3-Documentation/render-guides#1196, which is meant to be swapped to this workflow once it is available.Fit check (2026-07-04): an org-wide sweep (code search + per-repo workflow grep across all 41 non-archived repos) found exactly one Node/JS CI job in the org today — render-guides'
theme-js-tests. The input surface below covers it zero-config beyond paths, andcache/cache-dependency-pathkeep the workflow usable for lockfile-less or yarn/pnpm consumers without speculative package-manager switches.Inputs
commandnpm testworking-directory.package.json(monorepo support)node-version-file''.nvmrc, relative to the repository rootnode-version''node-version-fileinstall-commandnpm ci --no-progresscacheautoautocaches via npm only when the lock file exists (mirrors the graceful degradation ofreusable-php-command.yml's composer cache);npm/yarn/pnpmforce caching;''disablescache-dependency-path''package-lock.json,yarn.lock,pnpm-lock.yaml) inworking-directoryExample consumer
Notes
setup-node. Only an explicitcache: npm/yarn/pnpmfails loudly when the lock file is missing - which is then a real configuration error.actions/checkoutandactions/setup-nodeare SHA-pinned at the current latest (v7.0.0 / v6.4.0, verified via API). The existing reusables still pin checkout v6.0.2 — deliberately not touched here; can be bumped in a follow-up.run: ${{ inputs.command }}is the same trust model asreusable-php-command.yml:workflow_callinputs come from the calling repository's committed workflow file, not from external users.persist-credentials: falseon the checkout, justifiedzizmor: ignore[template-injection]annotations on the two command steps (code by contract — see the consumer contract note in [FEATURE] Add CI gate for the shared reusable workflows (lint, security, conformance, freshness) #16's README update), and the input descriptions state that command inputs must be static literals.yarn→yarn.lock,pnpm→pnpm-lock.yaml), fixing the case where forcing a non-npm cache silently looked forpackage-lock.json.reusable-node-command.ymlrow (status: Available), per the repo's documentation convention - detailed input/secret docs live in the YAMLinputs:definitions.