@@ -58,21 +58,25 @@ jobs:
5858 # Opened/reopened/updated PR: include PR author + title
5959 - name : " Construct JSON (for PR sync)"
6060 if : github.event_name == 'pull_request' && github.event.action != 'closed'
61- # Escape double quotes in PR title, as it will be used in a JSON string .
61+ # jq escapes backticks, double quotes etc. in PR title .
6262 run : |
63- escapedPrTitle=$(echo "${{ github.event.pull_request.title }}" | sed 's/"/\\"/g')
64- payload=$(cat <<'HEREDOC'
65- {
63+ payload=$(jq -n \
64+ --arg repoOwner '${{ github.repository_owner }}' \
65+ --arg num '${{ github.event.number }}' \
66+ --arg commitSha '${{ github.event.pull_request.head.sha }}' \
67+ --arg date '${{ github.event.pull_request.updated_at }}' \
68+ --arg prAuthor '${{ github.event.pull_request.user.login }}' \
69+ --arg prTitle '${{ github.event.pull_request.title }}' \
70+ '{
6671 "op": "put",
6772 "repo": "gdext",
68- "repo-owner": "${{ github.repository_owner }}",
69- "num": "${{ github.event.number }}",
70- "commit-sha": "${{ github.event.pull_request.head.sha }}",
71- "date": "${{ github.event.pull_request.updated_at }}",
72- "pr-author": "${{ github.event.pull_request.user.login }}",
73- "pr-title": "$escapedPrTitle"
74- }
75- HEREDOC)
73+ "repo-owner": $repoOwner,
74+ "num": $num,
75+ "commit-sha": $commitSha,
76+ "date": $date,
77+ "pr-author": $prAuthor,
78+ "pr-title": $prTitle
79+ }')
7680 echo "VAR=$payload"
7781 echo "GDEXT_JSON<<HEREDOC" >> $GITHUB_ENV
7882 echo "${payload}" >> $GITHUB_ENV
0 commit comments