Repository navigation
fix: pass the pull request body to jq as data - #326
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
The follow-up adds a network-free regression for the JSON sent by the action. It covers quotes, backslashes, a literal placeholder, newline handling, and an empty body. Literal This comment was drafted with Claude Code. |
andrii-bodnar
left a comment
There was a problem hiding this comment.
@pcbeingused33 thanks for the fix! The entrypoint.sh change looks good.
Could you please drop tests/pull-request-payload.sh from this PR? It pulls create_pull_request out with sed and stubs curl based on its exact flags, so it would break on unrelated refactors. It also isn't wired into CI. We'd rather keep this PR to the one-line fix.
|
Done, dropped This comment was drafted with Claude Code. |
A
pull_request_bodythat contains a double quote (HTML attributes,Update "strings") makescreate_pull_requestfail with a jq syntax error, so no pull request is opened.Cause:
entrypoint.shbuilds a"body":"..."fragment from the input and splices it into the jq program text.--arg bodyis passed but the filter never reads$body, so the body missed the jq sanitizing added in #202. Quotes break the program, a backslash such asC:\Usersis an invalid escape, and\(...)is evaluated by jq.Fix: the filter now reads
$bodyand adds thebodykey only when it is not empty. Real new lines are kept, and a literal\nis still turned into a new line, as before. Other hand-written escapes (for example\") are no longer interpreted: they appear in the body as written, so anyone who escaped quotes to work around this can drop the backslashes.Testing: checked locally by running the production
create_pull_requestwithcurlstubbed and inspecting the JSON it sends (quotes, backslashes, a literal placeholder, real and literal\nnew lines, other escapes, an empty body). Onmasterthe double-quote, backslash and escaped-quote cases fail; with this change all pass. As requested in review, that script is not part of this PR. The whole action was not run against GitHub.This change was prepared with AI assistance (Claude Code).