Skip to content

Commit 1c8ee2b

Browse files
authored
Merge pull request #51 from haya14busa/fix-herestring
Use here string to pass var to jq to avoid errors
2 parents 52f4e2f + 302e994 commit 1c8ee2b

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

entrypoint.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,9 @@ setup_from_labeled_event() {
4949
# - PR_TITLE
5050
setup_from_push_event() {
5151
pull_request="$(list_pulls | jq ".[] | select(.merge_commit_sha==\"${GITHUB_SHA}\")")"
52-
echo "${pull_request}" # debug
53-
LABELS=$(echo "${pull_request}" | jq '.labels | .[].name')
54-
PR_NUMBER=$(echo "${pull_request}" | jq -r .number)
55-
PR_TITLE=$(echo "${pull_request}" | jq -r .title)
52+
LABELS=$(jq '.labels | .[].name' <<< "${pull_request}")
53+
PR_NUMBER=$(jq -r .number <<< "${pull_request}")
54+
PR_TITLE=$(jq -r .title <<< "${pull_request}")
5655
}
5756

5857
list_pulls() {
@@ -100,7 +99,7 @@ post_comment() {
10099
body_text="$1"
101100
endpoint="${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/issues/${PR_NUMBER}/comments"
102101
# Do not quote body_text for multiline comments.
103-
body="$(echo ${body_text} | jq -ncR '{body: input}')"
102+
body="$(jq -ncR '{body: input}' <<< ${body_text})"
104103
curl -H "Authorization: token ${INPUT_GITHUB_TOKEN}" -d "${body}" "${endpoint}"
105104
}
106105

0 commit comments

Comments
 (0)