fix: don't abort semver set when a post_version hook's file is missing - #172
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
post_versionhook (replace/patch/regexp) whose targetfiledoesn't exist threw an uncaughtDeno.errors.NotFoundout ofpostVersionHook, aborting the wholesemver set/semver inc *run even though theVERSIONfile write and any earlier hooks had already succeeded.GITHUB_OUTPUTmechanism (writeGithubOutputinsrc/util/version.ts) as a newhook_warningsfield (JSON array of{ kind, file, reason }), so callers can detect and react to them (e.g. to leave a commit comment).kind, invalid config, etc.) still fail fast as before — this only relaxes the "target file doesn't exist" case.Test plan
deno fmt --checkdeno lintdeno test(CI — this environment's network policy blocks directregistry.npmjs.orgaccess needed to fetch npm deps, so it couldn't be run locally; added new cases tosrc/hooks/post.test.tscovering: a hook with a missing file resolves with a warning instead of rejecting, and remaining hooks still execute after one fails)