Skip to content

Commit a86900c

Browse files
Merge pull request #3 from Checkmarx/tag-jira-tasks-with-new-release
Tag JIRA tasks with new release (AST-000)
2 parents 2040fb4 + a6d1d5b commit a86900c

File tree

2 files changed

+48
-3
lines changed

2 files changed

+48
-3
lines changed

.github/workflows/release-notify.yml

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Notify Teams on Release
1+
name: Notify Teams and JIRA On New Release
22

33
on:
44
workflow_call:
@@ -84,6 +84,29 @@ jobs:
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
uses: Skitionek/[email protected]
@@ -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
}

.github/workflows/test-notify-teams.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ on:
3030
description: 'JIRA Release Name'
3131
required: true
3232
type: string
33+
default: JETBRAINS
3334

3435
jobs:
3536
test-notify:

0 commit comments

Comments
 (0)