fix: report failure for non-Error rejections in run()#60
Merged
Conversation
The catch block in run() only called core.setFailed when the thrown value was an Error instance. Non-Error rejections (strings, plain objects) were swallowed silently, so the action exited 0 reporting success even though the Miru CLI was never installed, leaving downstream workflow steps running without the CLI on PATH. Now any thrown value triggers core.setFailed, using error.message for Error instances and String(error) otherwise.
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
run()insrc/main.tsonly calledcore.setFailedwhen the caught value was anErrorinstance:If anything in
run()rejected/threw a non-Errorvalue (a string, a plain object, etc.), the catch swallowed it silently:core.setFailedwas never called,run()resolved normally, and the action exited 0 reporting success even though the Miru CLI was never installed. Downstream workflow steps then ran without the CLI onPATH, turning an install failure into a confusing later failure or silent misbehavior.Changes
src/main.ts: any thrown value now triggerscore.setFailed—error.messageforErrorinstances (behavior/message unchanged),String(error)otherwise.__tests__/main.test.ts: added a test covering the non-Errorrejection path.dist/: regenerated bundle (committed build output for the action).Test plan
npm run lintcleannpm run ci-test— 34/34 pass, 100% coverage, including the new non-Error rejection testnpm run package—dist/rebuilt with the fixhandles download error/handles extraction errortests still pass (Error message path unchanged)Generated by Claude Code