Skip to content

Modernize to node24/ESM, harden defaults, add tests and CI#7

Draft
rodbegbie wants to merge 1 commit intomainfrom
chore/modernize-and-harden
Draft

Modernize to node24/ESM, harden defaults, add tests and CI#7
rodbegbie wants to merge 1 commit intomainfrom
chore/modernize-and-harden

Conversation

@rodbegbie
Copy link
Copy Markdown

Summary

  • Bumps the action runtime to node24 (GA on GitHub Actions since Oct 2025) and converts source from CommonJS to ESM.
  • Bumps uuid (3 → 14), @actions/core (1 → 3); swaps deprecated @zeit/ncc for @vercel/ncc; standardises on npm (drops yarn.lock).
  • Hardening from review:
    • Default UUID is now v4 (random) instead of v1 (timestamp-based) — more honest default for a "give me a UUID" action.
    • namespace input is validated with uuid.validate(); bad input produces a clear setFailed message instead of a raw TypeError.
    • Error handler narrows unknown properly: error instanceof Error ? error.message : String(error).
    • Runtime pinned via engines.node and .nvmrc.
  • Adds:
    • test/run.test.js — 4 integration tests using node:test that spawn the action with controlled INPUT_* and GITHUB_OUTPUT env vars.
    • .github/workflows/ci.yml — runs the tests and fails if dist/ is out of sync with source.

Breaking change

Default UUID flavour changes from v1 → v4 when no name input is supplied. Consumers relying on the timestamp-ordered v1 default will need to set name/namespace explicitly to get v5, or pin to a previous tag.

Test plan

  • CI green on the new workflow (tests + dist-sync check)
  • Manually invoke the action in a downstream workflow with no inputs → confirm a v4 UUID is emitted
  • Manually invoke with name: hello → confirm a deterministic v5 UUID
  • Manually invoke with name: hello, namespace: not-a-uuid → confirm clean failure with the validation message

🤖 Generated with Claude Code

Bumps the action runtime to node24 and converts source from CommonJS
to ESM. Bumps uuid (3 -> 14) and @actions/core (1 -> 3); replaces the
deprecated @zeit/ncc with @vercel/ncc; removes yarn in favour of npm.

Hardening based on review:
- Default UUID is now v4 (random) instead of v1 (timestamp-based)
- namespace input validated with uuid.validate; clear error on bad input
- error handler narrows unknown to string instead of assuming Error
- pin runtime via engines.node and .nvmrc

Adds an integration test suite using node:test that spawns the action
with controlled env vars, plus a CI workflow that runs tests and
verifies dist/ is in sync with source.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant