1- name : Notify Teams on Release
1+ name : Notify Teams and JIRA On New Release
22
33on :
44 workflow_call :
8484 echo "formatted_contributors=$formatted_contributors" >> $GITHUB_OUTPUT
8585 echo "escaped_contributors_links=escaped_contributors_links" >> $GITHUB_OUTPUT
8686
87+ - name : Extract Jira Ticket IDs
88+ id : extract_jira_tickets
89+ run : |
90+ # Extract all AST-XXX patterns
91+ jira_tickets=$(echo "${{ steps.fetch_release_notes.outputs.release_notes }}" | grep -oE 'AST-[0-9]+' | sort -u)
92+
93+ echo "Filtered Jira Tickets:"
94+
95+ valid_tickets=()
96+ for ticket in $jira_tickets; do
97+ if ! [[ $ticket =~ ^AST-0{3,}$ ]]; then
98+ echo "$ticket"
99+ valid_tickets+=("\"$ticket\"")
100+ fi
101+ done
102+
103+ # Format Jira tickets as a JSON array
104+ formatted_jira_tickets=$(IFS=,; echo "[${valid_tickets[*]}]")
105+
106+ echo "Formatted Jira Tickets: $formatted_jira_tickets"
107+
108+ echo "formatted_jira_tickets=$formatted_jira_tickets" >> $GITHUB_OUTPUT
109+
87110
88111 - name : Send notification to Teams
89112@@ -141,16 +164,37 @@ jobs:
141164 id : current-date
142165 run : echo "date=$(date +%Y-%m-%d)" >> $GITHUB_ENV
143166
144- - name : Send payload to JIRA Automation Webhook
167+ - name : Generate Release Version
168+ id : generate_jira_release_version
169+ run : |
170+ jira_release_version="${{ inputs.jira_product_name }}_${{ inputs.release_version }}"
171+ echo "Generated Release Version: jira_release_version"
172+ echo "jira_release_version=$jira_release_version" >> $GITHUB_OUTPUT
173+
174+ - name : Create New JIRA Release
145175 uses : satak/webrequest-action@master
146176 with :
147177 url : ${{ secrets.JIRA_RELEASE_WEBHOOK_URL }}
148178 method : POST
149179 payload : |
150180 {
151181 "data": {
152- "version": "${{ inputs.jira_product_name }}_${{ inputs .release_version }}",
182+ "version": "${{ steps.generate_jira_release_version.outputs .release_version }}",
153183 "startDate": "${{ env.date }}",
154184 "date": "${{ env.date }}"
155185 }
186+ }
187+
188+ - name : Send Jira Tickets to Webhook
189+ uses : satak/webrequest-action@master
190+ with :
191+ url : ${{ secrets.JIRA_TICKETS_WEBHOOK_URL }}
192+ headers : ' {"X-Automation-Webhook-Token": "${{ secrets.JIRA_AUTOMATION_WEBHOOK_TOKEN }}"}'
193+ method : POST
194+ payload : |
195+ {
196+ "issues": ${{ steps.extract_jira_tickets.outputs.formatted_jira_tickets }},
197+ "data": {
198+ "releaseVersion": "${{ steps.generate_jira_release_version.outputs.release_version }}"
199+ }
156200 }
0 commit comments