Skip to content

Commit cf0611d

Browse files
committed
Pass args to jq via --arg
1 parent a906477 commit cf0611d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

.github/workflows/post-pr-comment.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ jobs:
5353
# - comment belongs to the PR with number $PR_NUMBER
5454
# - comment starts with the expected prefix ("QHelp previews")
5555
# - comment author is github-actions[bot]
56-
FILTER="select(.issue_url | test(\"${GITHUB_REPOSITORY}/issues/${PR_NUMBER}$\")) \
57-
| select(.body | test(\"^${COMMENT_PREFIX}\")) \
58-
| select(.user.login == \"${COMMENT_AUTHOR}\") \
59-
| .id"
60-
COMMENT_ID=$(gh api "repos/${GITHUB_REPOSITORY}/issues/comments/${RAW_COMMENT_ID}" | jq "${FILTER}")
56+
FILTER='select(.issue_url | endswith($repo+"/issues/"+$pr))
57+
| select(.body | startswith($prefix))
58+
| select(.user.login == $author)
59+
| .id'
60+
COMMENT_ID=$(gh api "repos/${GITHUB_REPOSITORY}/issues/comments/${COMMENT_ID}" | jq --arg repo "${GITHUB_REPOSITORY}" --arg pr "${PR_NUMBER}" --arg prefix "${COMMENT_PREFIX}" --arg author "${COMMENT_AUTHOR}" "${FILTER}")
6161
if [ $COMMENT_ID ]
6262
then
6363
# Update existing comment

0 commit comments

Comments
 (0)