Repository navigation
fix: print the payload, not [object Object], when a command has no issue or pull number - #373
Merged
Merged
Conversation
…sue or pull number
18 handlers interpolated `${context.payload}` into their "github context
payload missing issue/pull/pr number" error, which renders as
`[object Object]`. They now use `JSON.stringify(context.payload)`, the
convention the other 9 "missing ..." errors already follow. The message
prefix and the thrown error types are unchanged.
A parametrized test drives each of the 18 sites with a payload lacking the
number and asserts the exact message and the absence of `[object Object]`.
Signed-off-by: Jeffrey Sica <me@jeefy.dev>
Signed-off-by: Jeffrey Sica <me@jeefy.dev>
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.
Bug
18 command handlers build their "missing issue/pull/pr number" error with
${context.payload}, so the message ends in[object Object]:The other 9 "github context payload missing ..." errors already use
JSON.stringify(...).Affected:
issueComment/{approve,assign,cc,close,lock,meow,milestone,reopen,retitle,trigger,unassign,uncc}.ts,labels/{fixed,hold,lgtm,prefixed,remove}.ts,pullReq/onPrLgtm.ts.Fix
Interpolate
${JSON.stringify(context.payload)}in those 18 sites, matching the existing convention. Message prefix and error types are unchanged; no other behaviour change.dist/regenerated withnpm run pack.Tests
__tests__/missingNumberMessage.test.ts: one parametrized case per site (18) feeding a payload without the number, asserting the exact message (github context payload missing <issue|pull|pr> number: <JSON payload>) and that it contains no[object Object]; msw withfailOnUnhandledRequest, so the handlers must refuse before any API call. All 18 cases fail onmainand pass here.npm run all(1843 tests),npm run test:coverage(100 / 99.82 / 100 / 100),npm run test:coverage:e2epass; a secondnpm run packleavesdist/clean.Note: open PR #343's expected messages pin
[object Object]; those expectations should drop it (they will become the JSON payload) once this lands.