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
More on Custom Actions & Reusable Workflows
What are the three kinds of custom action and how do you choose?BeginnerWrite a minimal composite action that installs Node and dependencies with caching.IntermediateWhat can a composite action not do compared to a job?IntermediateHow do you pass outputs out of a composite action?IntermediateWhat does `action.yml` contain for a JavaScript action?IntermediateShow the core of a JavaScript action using the toolkit.Advanced