Interview Prep/GitHub Actions/Custom Actions & Reusable Workflows

Why must a JavaScript action commit its `dist/` or `node_modules`?

IntermediateConceptCustom Actions & Reusable Workflows
Answer

The runner downloads the action repository at the ref and runs main directly; it does not run npm install. Without bundled dependencies you get Error: Cannot find module '@actions/core'. Bundle into a single file with @vercel/ncc or Rollup, commit dist/, and add a CI check that rebuilds and fails if dist/ differs from the committed copy, so source and shipped code never diverge.

npx @vercel/ncc build src/index.js -o dist --source-map --license licenses.txt
All GitHub Actions questions Roadmap: GitHub Actions

More on Custom Actions & Reusable Workflows