Skip to content

Commit 57eaa1d

Browse files
Merge pull request #12 from mmb/title-quotes
Use --arg for PR title to escape quotes
2 parents b7c3f39 + 0631979 commit 57eaa1d

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

assets/helpers/git.sh

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,19 @@ add_pullrequest_metadata_basic() {
4747
local commit=$(git rev-parse HEAD)
4848
local author=$(git log -1 --format=format:%an)
4949

50-
jq ". + [
51-
{name: \"id\", value: \"${1}\"},
52-
{name: \"title\", value: \"${title}\"},
53-
{name: \"author\", value: \"${author}\"},
54-
{name: \"commit (merged source in target)\", value: \"${commit}\"},
55-
{name: \"repository\", value: \"${2}\"}
56-
]"
50+
jq \
51+
--arg id "$1" \
52+
--arg title "$title" \
53+
--arg author "$author" \
54+
--arg commit "$commit" \
55+
--arg repository "$2" \
56+
'. + [
57+
{name: "id", value: $id},
58+
{name: "title", value: $title},
59+
{name: "author", value: $author},
60+
{name: "commit (merged source in target)", value: $commit},
61+
{name: "repository", value: $repository}
62+
]'
5763
}
5864

5965
add_pullrequest_metadata_commit() {
@@ -66,7 +72,7 @@ add_pullrequest_metadata_commit() {
6672
local author_date=$(git log $filter --format=format:%ai)
6773
local committer=$(git log $filter --format=format:%cn)
6874
local committer_date=$(git log $filter --format=format:%ci)
69-
local message=$(git log $filter --format=format:%B | sed 's/\"/\\"/g')
75+
local message=$(git log $filter --format=format:%B)
7076

7177
local metadata=""
7278
metadata+="{name: \"($1) commit\", value: \"${commit}\"},"

0 commit comments

Comments
 (0)