Skip to content

Add a reusable Node.js CI workflow (install, lint, test, audit) #6

Description

@iampopye

The gap

This collection covers Go, Terraform, Docker and Kubernetes but has nothing for Node.js, which is probably the most common stack a new DevOps engineer will be asked to build a pipeline for.

What to build

.github/workflows/node/reusable-node-ci.yml, following the same shape as the existing workflows.

Suggested inputs:

input type default purpose
node_version_file string .nvmrc read the version from the repo rather than hardcoding it
package_manager string npm npm, pnpm or yarn
run_lint boolean true
run_audit boolean true npm audit --audit-level=high
working_directory string . for monorepos

House rules (CI enforces these)

  • Start the file with permissions: {} and grant the minimum per job
  • actions/* may use major tags (@v7); anything third-party must be pinned to a full 40-character commit SHA with a trailing # vX.Y.Z comment
  • Every input needs a description
  • Read CONTRIBUTING.md first

How to check your work

bash <(curl -fsSL https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
./actionlint .github/workflows/node/reusable-node-ci.yml

Best if you can also link a run from your own fork proving it works against a real project.

Happy to help scope this if you want to take it on but are not sure where to start.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions