Repository navigation
fix: pass the pull request body to jq as data - #326
Open
pcbeingused33 wants to merge 3 commits into
Open
pcbeingused33 wants to merge 3 commits into
pcbeingused33 wants to merge 3 commits into
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Author
|
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. |
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.
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:
tests/pull-request-payload.sh(Bash and jq, no network: curl is stubbed) runs the productioncreate_pull_requestand checks the JSON it sends for quotes, backslashes, a literal placeholder, real and literal\nnew lines, other escapes and an empty body. Onmasterthe double-quote, backslash and escaped-quote cases fail; with this change all seven pass. The whole action was not run against GitHub.This change was prepared with AI assistance (Claude Code).