Skip to content

fix: don't abort semver set when a post_version hook's file is missing - #172

Merged
justinmchase merged 1 commit into
mainfrom
fix/hook-missing-file-warning
Aug 20, 2026
Merged

fix: don't abort semver set when a post_version hook's file is missing#172
justinmchase merged 1 commit into
mainfrom
fix/hook-missing-file-warning

Conversation

@justinmchase

Copy link
Copy Markdown
Collaborator

Summary

  • Fixes post_version hook aborts entire 'semver set' run when hook target file is missing #171
  • A post_version hook (replace/patch/regexp) whose target file doesn't exist threw an uncaught Deno.errors.NotFound out of postVersionHook, aborting the whole semver set/semver inc * run even though the VERSION file write and any earlier hooks had already succeeded.
  • Missing hook files are now treated as recoverable warnings: the hook is skipped, remaining hooks still run, and the process still exits 0.
  • Warnings are collected and surfaced via the existing GITHUB_OUTPUT mechanism (writeGithubOutput in src/util/version.ts) as a new hook_warnings field (JSON array of { kind, file, reason }), so callers can detect and react to them (e.g. to leave a commit comment).
  • Other hook error types (unknown kind, invalid config, etc.) still fail fast as before — this only relaxes the "target file doesn't exist" case.

Test plan

  • deno fmt --check
  • deno lint
  • deno test (CI — this environment's network policy blocks direct registry.npmjs.org access needed to fetch npm deps, so it couldn't be run locally; added new cases to src/hooks/post.test.ts covering: a hook with a missing file resolves with a warning instead of rejecting, and remaining hooks still execute after one fails)

A post_version hook (replace/patch/regexp) whose target `file` doesn't
exist threw an uncaught Deno.errors.NotFound out of postVersionHook,
which aborted the whole `semver set`/`semver inc` run even though the
VERSION file write and any earlier hooks had already succeeded.

Treat a missing hook file as a recoverable warning instead: log it,
skip that hook, and keep running the rest. Warnings are collected and
surfaced via the existing GITHUB_OUTPUT mechanism as `hook_warnings`
so callers can react to them. Other hook error types (unknown kind,
bad config, etc.) still fail fast as before.

Fixes #171
@github-actions github-actions Bot added the bug Something isn't working label Aug 20, 2026
@justinmchase
justinmchase merged commit 3ad2548 into main Aug 20, 2026
6 checks passed
@justinmchase
justinmchase deleted the fix/hook-missing-file-warning branch August 20, 2026 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

post_version hook aborts entire 'semver set' run when hook target file is missing

1 participant