Skip to content

Commit f8c3c4b

Browse files
committed
Prevent quotes in commit messages from breaking json
Use jq to generate json so it will be escaped.
1 parent feefbbd commit f8c3c4b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

assets/helpers/git.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ add_pullrequest_metadata_commit() {
7272
metadata+="{name: \"($1) commit\", value: \"${commit}\"},"
7373
metadata+="{name: \"($1) author\", value: \"${author}\"},"
7474
metadata+="{name: \"($1) author_date\", value: \"${author_date}\", type: \"time\"},"
75-
metadata+="{name: \"($1) message\", value: \"${message}\", type: \"message\"}"
75+
metadata+=$(jq -n --arg name "($1) message" --arg value "$message" '{name: $name, value: $value, type: "message"}')
7676

7777
if [ "$author" != "$committer" ]; then
7878
metadata+=",{name: \"($1) committer\", value: \"${committer}\"}"

0 commit comments

Comments
 (0)