From cb3eff44b1dc8a4361f5d1838200528693953501 Mon Sep 17 00:00:00 2001 From: Ilia Mogilevsky Date: Tue, 26 Sep 2023 15:15:17 +1000 Subject: [PATCH] chore: adding ability to handle bulletpoints from jira api response --- scripts/release/release-notes-onprem.sh | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/scripts/release/release-notes-onprem.sh b/scripts/release/release-notes-onprem.sh index b64a6c36..2cd2863e 100755 --- a/scripts/release/release-notes-onprem.sh +++ b/scripts/release/release-notes-onprem.sh @@ -101,7 +101,19 @@ if [ -n "$IS_RELEASE" ]; then echo "Done." fi - +jira_parse_content() { + local content=$1 + local type=$(echo $content | jq -r '.fields.customfield_11009.content[].type') + + case $type in + "paragraph") + echo $content | jq -r '.fields.customfield_11009.content[].content[].text' + ;; + "bulletList") + echo $content | jq -r '[.fields.customfield_11009.content[].content[].content[].content[] | .text] | join(", ")' + ;; + esac +} #################### # Find all related tickets #################### @@ -130,16 +142,16 @@ for i in $(git log $PROD_TAG...$DEV_TAG | grep -Eo '(PACT-|CC-)([0-9]+)' | sort fi release_type=$(echo $response | jq '.fields.customfield_18528.value' | tr -d '"') - has_note=$(echo $response | jq '.fields.customfield_11009' | tr -d '"') + ticket_note=$(echo $response | jq '.fields.customfield_11009' | tr -d '"') note="null" - if [ "$has_note" != "null" ]; then - note=$(echo $response | jq '.fields.customfield_11009.content[].content[].text' | tr -d '"') + if [ "$ticket_note" != "null" ]; then + note=$(jira_parse_content $response) fi - if [ "$release_type" = "Feature" ] && [ "$has_note" != "null" ] && [ "$note" != "null" ]; then + if [ "$release_type" = "Feature" ] && [ "$ticket_note" != "null" ] && [ "$note" != "null" ]; then features+="\n* "$note - elif [ "$release_type" = "Fix" ] && [ "$has_note" != "null" ] && [ "$note" != "null" ]; then + elif [ "$release_type" = "Fix" ] && [ "$ticket_note" != "null" ] && [ "$note" != "null" ]; then fixes+="\n* "$note fi