- Install Node.js 24 or newer.
- Install dependencies:
npm ciIf you are bootstrapping from scratch and no lockfile exists yet, run npm install once, then commit the generated package-lock.json.
Compile TypeScript:
npm run buildBundle the action dist/ entrypoints for GitHub Actions:
npm run bundleThat command produces:
dist/index.cjsfor the main actiondist/post/index.cjsfor the post-step cache save
The generated dist/ files must be committed, because GitHub Actions consumers run the checked-in dist/ output directly.
Run the unit tests:
npm testThis runs the TypeScript tests directly with Vitest.
Run the action repo checks locally:
npm test
npm run bundle
git diff --statgit diff should only show the source and generated dist/ changes you intend to release.
- Make the source changes.
- Run
npm ci. - Run
npm test. - Run
npm run bundle. - Commit both source files and the generated
dist/output. - Push the commit to
main. - Open the
Releaseworkflow in GitHub Actions and run it manually with the desired version, for examplev1.2.0or1.2.0. - The workflow re-runs validation, creates the GitHub Release with generated notes, and creates the corresponding Git tag from the current
maincommit. - For stable semver tags, the workflow also moves the matching major tag such as
v1.
You do not need to create or push the version tag manually; the workflow does that via GitHub when it creates the release.
Consumers should normally reference the major tag:
- uses: j178/prek-action@v1