Skip to content

Commit 4bf30a7

Browse files
.
1 parent d99d0a8 commit 4bf30a7

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

.github/workflows/jira_issue.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,25 @@ jobs:
8080
JIRA_KEY: ${{ steps.create.outputs.jira_key }}
8181
ISSUE_TITLE: ${{ github.event.issue.title }}
8282
run: |
83+
TITLE=$(echo "${ISSUE_TITLE//`/\\`}" | sed 's/"/\\"/g' | sed "s/'/\\\'/g")
84+
PAYLOAD=$(jq -n \
85+
--arg issuetitle "$TITLE" \
86+
--arg jirakey "$JIRA_KEY" \
87+
'{
88+
title: ($jirakey + ": " + $issuetitle)
89+
}')
90+
8391
# Update Github issue title with jira id
84-
GH_UPD_RESPONSE=$(curl -s \
92+
curl -s \
8593
-X PATCH \
8694
-H "Authorization: Bearer $GITHUB_TOKEN" \
8795
-H "Accept: application/vnd.github+json" \
8896
-H "X-GitHub-Api-Version: 2022-11-28" \
8997
"https://api.github.com/repos/$REPOSITORY/issues/$ISSUE_NUMBER" \
90-
-d "{\"title\":\"$JIRA_KEY: $ISSUE_TITLE\"}")
98+
-d "$PAYLOAD"
99+
100+
if [ "$?" != 0 ]; then
101+
echo "Failed to update GH issue. Payload was:"
102+
echo "$PAYLOAD"
103+
exit 1
104+
fi

0 commit comments

Comments
 (0)