-
Notifications
You must be signed in to change notification settings - Fork 0
652 lines (628 loc) · 47.7 KB
/
Copy pathjob-send-notification.yml
File metadata and controls
652 lines (628 loc) · 47.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
name: Send Notification Job
on:
workflow_call:
inputs:
trigger_type:
description: 'Trigger type (workflow_dispatch, pull_request, schedule)'
required: true
type: string
waf_enabled:
description: 'Enable WAF'
required: false
default: false
type: boolean
EXP:
description: 'Enable EXP'
required: false
default: false
type: boolean
run_e2e_tests:
description: 'Run End-to-End Tests'
required: false
default: 'GoldenPath-Testing'
type: string
existing_webapp_url:
description: 'Existing Container WebApp URL (Skips Deployment)'
required: false
default: ''
type: string
deploy_result:
description: 'Deploy job result (success, failure, skipped)'
required: true
type: string
e2e_test_result:
description: 'E2E test job result (success, failure, skipped)'
required: false
default: ''
type: string
CONTAINER_WEB_APPURL:
description: 'Container Web App URL'
required: false
default: ''
type: string
RESOURCE_GROUP_NAME:
description: 'Resource Group Name'
required: false
default: ''
type: string
QUOTA_FAILED:
description: 'Quota Check Failed Flag'
required: false
default: 'false'
type: string
TEST_SUCCESS:
description: 'Test Success Flag'
required: false
default: ''
type: string
TEST_REPORT_URL:
description: 'Test Report URL'
required: false
default: ''
type: string
cleanup_result:
description: 'Cleanup job result (success, failure, skipped)'
required: false
default: 'skipped'
type: string
env:
GPT_5_4_MINI_MIN_CAPACITY: 100
BRANCH_NAME: ${{ github.event.workflow_run.head_branch || github.head_ref || github.ref_name }}
WAF_ENABLED: ${{ inputs.trigger_type == 'workflow_dispatch' && (inputs.waf_enabled || false) || false }}
EXP: ${{ inputs.trigger_type == 'workflow_dispatch' && (inputs.EXP || false) || false }}
RUN_E2E_TESTS: ${{ inputs.trigger_type == 'workflow_dispatch' && (inputs.run_e2e_tests || 'GoldenPath-Testing') || 'GoldenPath-Testing' }}
jobs:
send-notification:
runs-on: ubuntu-latest
continue-on-error: true
env:
accelerator_name: "MACAE V4"
steps:
- name: Determine Test Suite Display Name
id: test_suite
shell: bash
env:
RUN_E2E_TESTS: ${{ env.RUN_E2E_TESTS }}
run: |
if [ "$RUN_E2E_TESTS" = "GoldenPath-Testing" ]; then
TEST_SUITE_NAME="Golden Path Testing"
elif [ "$RUN_E2E_TESTS" = "Smoke-Testing" ]; then
TEST_SUITE_NAME="Smoke Testing"
elif [ "$RUN_E2E_TESTS" = "None" ]; then
TEST_SUITE_NAME="None"
else
TEST_SUITE_NAME="$RUN_E2E_TESTS"
fi
echo "TEST_SUITE_NAME=$TEST_SUITE_NAME" >> $GITHUB_OUTPUT
echo "Test Suite: $TEST_SUITE_NAME"
- name: Determine Cleanup Pill
id: cleanup
shell: bash
env:
CLEANUP_RESULT: ${{ inputs.cleanup_result }}
run: |
PILL_BASE="display:inline-block; min-width:70px; text-align:center; padding:4px 12px; border-radius:20px; font-size:12px; font-weight:600; line-height:1.4;"
case "$CLEANUP_RESULT" in
success)
CLEANUP_PILL="<span style=\"${PILL_BASE} background:#d4edda; color:#155724;\">✅ SUCCESS</span>"
;;
failure)
CLEANUP_PILL="<span style=\"${PILL_BASE} background:#f8d7da; color:#721c24;\">❌ FAILED</span>"
;;
*)
CLEANUP_PILL="<span style=\"${PILL_BASE} background:#d4edda; color:#155724;\">⏭️ SKIPPED</span>"
;;
esac
echo "CLEANUP_PILL=$CLEANUP_PILL" >> $GITHUB_OUTPUT
- name: Determine Configuration Label
id: config
shell: bash
env:
WAF_ENABLED: ${{ env.WAF_ENABLED }}
EXP: ${{ env.EXP }}
run: |
WAF_LABEL=$( [ "$WAF_ENABLED" = "true" ] && echo "WAF" || echo "Non-WAF" )
EXP_LABEL=$( [ "$EXP" = "true" ] && echo "EXP" || echo "Non-EXP" )
echo "CONFIG_LABEL=${WAF_LABEL} + ${EXP_LABEL}" >> $GITHUB_OUTPUT
# ------------------------------------------------------------------
# Quota failure
# ------------------------------------------------------------------
- name: Send Quota Failure Notification
if: inputs.deploy_result == 'failure' && inputs.QUOTA_FAILED == 'true'
shell: bash
env:
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_RUN_ID: ${{ github.run_id }}
ACCELERATOR_NAME: ${{ env.accelerator_name }}
LOGICAPP_URL: ${{ secrets.EMAILNOTIFICATION_LOGICAPP_URL_TA }}
CLEANUP_PILL: ${{ steps.cleanup.outputs.CLEANUP_PILL }}
CONFIG_LABEL: ${{ steps.config.outputs.CONFIG_LABEL }}
run: |
RUN_URL="https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
PILL_BASE="display:inline-block; min-width:70px; text-align:center; padding:4px 12px; border-radius:20px; font-size:12px; font-weight:600; line-height:1.4;"
DEPLOY_PILL="<span style=\"${PILL_BASE} background:#f8d7da; color:#721c24;\">❌ FAILED</span>"
E2E_PILL="<span style=\"${PILL_BASE} background:#d4edda; color:#155724;\">⏭️ SKIPPED</span>"
BODY_HTML=$(cat <<HTML
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" style="background-color:#ffffff; padding:40px 20px; font-family:'Segoe UI',Tahoma,Geneva,Verdana,sans-serif;">
<tr><td align="center">
<table role="presentation" width="800" cellpadding="0" cellspacing="0" style="background-color:#ffffff; border:1px solid #e5e7eb; border-radius:8px; overflow:hidden; box-shadow:0 1px 3px rgba(0,0,0,0.08);">
<tr><td style="background-color:#ef4444; padding:24px 40px;">
<table width="100%" cellpadding="0" cellspacing="0"><tr>
<td><h1 style="margin:0; color:#ffffff; font-size:20px; font-weight:700;">Pipeline Failed — Insufficient Quota</h1>
<p style="margin:6px 0 0; color:rgba(255,255,255,0.9); font-size:13px;">${ACCELERATOR_NAME} Accelerator • CI/CD Automation</p></td>
<td align="right" style="vertical-align:middle;">
<span style="background:rgba(255,255,255,0.2); color:#fff; padding:6px 14px; border-radius:4px; font-size:12px; font-weight:600;">${CONFIG_LABEL}</span>
</td>
</tr></table>
</td></tr>
<tr><td style="padding:32px 40px;">
<p style="color:#374151; font-size:14px; line-height:1.7; margin:0 0 28px;">Dear Team,<br>The <strong>${ACCELERATOR_NAME}</strong> deployment has <span style="color:#dc2626; font-weight:700;">failed due to insufficient quota</span>.</p>
<div style="background:#f8f9fb; border-radius:8px; padding:20px; margin-bottom:24px;">
<h3 style="margin:0 0 16px; color:#1a1a2e; font-size:14px; text-transform:uppercase; letter-spacing:0.5px;">Status Summary</h3>
<table width="100%" cellpadding="0" cellspacing="0" style="font-size:14px;">
<tr><td style="padding:10px 0; border-bottom:1px solid #e8eaed; color:#5f6368;">Deployment</td><td align="right" style="padding:10px 0; border-bottom:1px solid #e8eaed;">${DEPLOY_PILL}</td></tr>
<tr><td style="padding:10px 0; border-bottom:1px solid #e8eaed; color:#5f6368;">E2E Tests</td><td align="right" style="padding:10px 0; border-bottom:1px solid #e8eaed;">${E2E_PILL}</td></tr>
<tr><td style="padding:10px 0; color:#5f6368;">Cleanup</td><td align="right" style="padding:10px 0;">${CLEANUP_PILL}</td></tr>
</table>
</div>
<div style="background:#fff5f5; border-radius:8px; padding:14px 20px; margin-bottom:24px; border-left:4px solid #ef4444;">
<span style="font-size:13px; color:#742a2a;">Please resolve the quota issue and retry the deployment.</span>
</div>
<h3 style="margin:0 0 14px; font-size:13px; text-transform:uppercase; letter-spacing:0.5px; color:#6b7280; border-bottom:2px solid #e5e7eb; padding-bottom:8px;">Deployment Details</h3>
<table width="100%" cellpadding="0" cellspacing="0" style="margin-bottom:28px;">
<tr><td style="padding:8px 0; font-size:13px; color:#6b7280; width:140px;">Triggered By</td>
<td style="padding:8px 0; font-size:13px; color:#111827;">${{ github.actor }}</td></tr>
<tr><td style="padding:8px 0; font-size:13px; color:#6b7280;">Branch</td>
<td style="padding:8px 0; font-size:13px; color:#111827; font-family:'Cascadia Code','Courier New',monospace;">${{ env.BRANCH_NAME }}</td></tr>
</table>
<table role="presentation" width="100%" cellpadding="0" cellspacing="0"><tr><td align="center" style="padding:8px 0;">
<a href="${RUN_URL}" style="display:inline-block; background:#dc2626; color:#ffffff; text-decoration:none; padding:12px 28px; border-radius:4px; font-size:13px; font-weight:600; letter-spacing:0.3px;">VIEW PIPELINE RUN</a>
</td></tr></table>
</td></tr>
<tr><td style="background:#f9fafb; padding:20px 40px; border-top:1px solid #e5e7eb;">
<table width="100%" cellpadding="0" cellspacing="0"><tr>
<td style="font-size:11px; color:#9ca3af;">CI/CD Automation Pipeline</td>
<td align="right" style="font-size:11px; color:#9ca3af;">${ACCELERATOR_NAME} Accelerator</td>
</tr></table>
</td></tr>
</table>
</td></tr>
</table>
HTML
)
BODY_JSON=$(printf '%s' "$BODY_HTML" | python3 -c 'import json,sys; print(json.dumps(sys.stdin.read()))')
PAYLOAD="{\"subject\":\"\u274C[CI/CD-Automation] [${ACCELERATOR_NAME}] Insufficient Quota\",\"body\":${BODY_JSON}}"
curl -X POST "${LOGICAPP_URL}" \
-H "Content-Type: application/json" \
-d "$PAYLOAD" || echo "Failed to send quota failure notification"
# ------------------------------------------------------------------
# Deployment failure (non-quota)
# ------------------------------------------------------------------
- name: Send Deployment Failure Notification
if: inputs.deploy_result == 'failure' && inputs.QUOTA_FAILED != 'true'
shell: bash
env:
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_RUN_ID: ${{ github.run_id }}
INPUT_RESOURCE_GROUP_NAME: ${{ inputs.RESOURCE_GROUP_NAME }}
ACCELERATOR_NAME: ${{ env.accelerator_name }}
LOGICAPP_URL: ${{ secrets.EMAILNOTIFICATION_LOGICAPP_URL_TA }}
CONFIG_LABEL: ${{ steps.config.outputs.CONFIG_LABEL }}
CLEANUP_PILL: ${{ steps.cleanup.outputs.CLEANUP_PILL }}
run: |
RUN_URL="https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
RESOURCE_GROUP="$INPUT_RESOURCE_GROUP_NAME"
PILL_BASE="display:inline-block; min-width:70px; text-align:center; padding:4px 12px; border-radius:20px; font-size:12px; font-weight:600; line-height:1.4;"
DEPLOY_PILL="<span style=\"${PILL_BASE} background:#f8d7da; color:#721c24;\">❌ FAILED</span>"
E2E_PILL="<span style=\"${PILL_BASE} background:#d4edda; color:#155724;\">⏭️ SKIPPED</span>"
BODY_HTML=$(cat <<HTML
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" style="background-color:#ffffff; padding:40px 20px; font-family:'Segoe UI',Tahoma,Geneva,Verdana,sans-serif;">
<tr><td align="center">
<table role="presentation" width="800" cellpadding="0" cellspacing="0" style="background-color:#ffffff; border:1px solid #e5e7eb; border-radius:8px; overflow:hidden; box-shadow:0 1px 3px rgba(0,0,0,0.08);">
<tr><td style="background-color:#ef4444; padding:24px 40px;">
<table width="100%" cellpadding="0" cellspacing="0"><tr>
<td><h1 style="margin:0; color:#ffffff; font-size:20px; font-weight:700;">Pipeline Failed</h1>
<p style="margin:6px 0 0; color:rgba(255,255,255,0.9); font-size:13px;">${ACCELERATOR_NAME} Accelerator • CI/CD Automation</p></td>
<td align="right" style="vertical-align:middle;">
<span style="background:rgba(255,255,255,0.2); color:#fff; padding:6px 14px; border-radius:4px; font-size:12px; font-weight:600;">${CONFIG_LABEL}</span>
</td>
</tr></table>
</td></tr>
<tr><td style="padding:32px 40px;">
<p style="color:#374151; font-size:14px; line-height:1.7; margin:0 0 28px;">Dear Team,<br>The <strong>${ACCELERATOR_NAME}</strong> deployment has <span style="color:#dc2626; font-weight:700;">failed</span>. Please investigate at your earliest convenience.</p>
<div style="background:#f8f9fb; border-radius:8px; padding:20px; margin-bottom:24px;">
<h3 style="margin:0 0 16px; color:#1a1a2e; font-size:14px; text-transform:uppercase; letter-spacing:0.5px;">Status Summary</h3>
<table width="100%" cellpadding="0" cellspacing="0" style="font-size:14px;">
<tr><td style="padding:10px 0; border-bottom:1px solid #e8eaed; color:#5f6368;">Deployment</td><td align="right" style="padding:10px 0; border-bottom:1px solid #e8eaed;">${DEPLOY_PILL}</td></tr>
<tr><td style="padding:10px 0; border-bottom:1px solid #e8eaed; color:#5f6368;">E2E Tests</td><td align="right" style="padding:10px 0; border-bottom:1px solid #e8eaed;">${E2E_PILL}</td></tr>
<tr><td style="padding:10px 0; color:#5f6368;">Cleanup</td><td align="right" style="padding:10px 0;">${CLEANUP_PILL}</td></tr>
</table>
</div>
<div style="background:#fff5f5; border-radius:8px; padding:14px 20px; margin-bottom:24px; border-left:4px solid #ef4444;">
<span style="font-size:13px; color:#742a2a;">Please investigate the deployment failure at your earliest convenience.</span>
</div>
<h3 style="margin:0 0 14px; font-size:13px; text-transform:uppercase; letter-spacing:0.5px; color:#6b7280; border-bottom:2px solid #e5e7eb; padding-bottom:8px;">Deployment Details</h3>
<table width="100%" cellpadding="0" cellspacing="0" style="margin-bottom:28px;">
<tr><td style="padding:8px 0; font-size:13px; color:#6b7280; width:140px;">Resource Group</td>
<td style="padding:8px 0; font-size:13px; color:#111827; font-family:'Cascadia Code','Courier New',monospace;">${RESOURCE_GROUP}</td></tr>
<tr><td style="padding:8px 0; font-size:13px; color:#6b7280;">Triggered By</td>
<td style="padding:8px 0; font-size:13px; color:#111827;">${{ github.actor }}</td></tr>
<tr><td style="padding:8px 0; font-size:13px; color:#6b7280;">Branch</td>
<td style="padding:8px 0; font-size:13px; color:#111827; font-family:'Cascadia Code','Courier New',monospace;">${{ env.BRANCH_NAME }}</td></tr>
</table>
<table role="presentation" width="100%" cellpadding="0" cellspacing="0"><tr><td align="center" style="padding:8px 0;">
<a href="${RUN_URL}" style="display:inline-block; background:#dc2626; color:#ffffff; text-decoration:none; padding:12px 28px; border-radius:4px; font-size:13px; font-weight:600; letter-spacing:0.3px;">INVESTIGATE FAILURE</a>
</td></tr></table>
</td></tr>
<tr><td style="background:#f9fafb; padding:20px 40px; border-top:1px solid #e5e7eb;">
<table width="100%" cellpadding="0" cellspacing="0"><tr>
<td style="font-size:11px; color:#9ca3af;">CI/CD Automation Pipeline</td>
<td align="right" style="font-size:11px; color:#9ca3af;">${ACCELERATOR_NAME} Accelerator</td>
</tr></table>
</td></tr>
</table>
</td></tr>
</table>
HTML
)
BODY_JSON=$(printf '%s' "$BODY_HTML" | python3 -c 'import json,sys; print(json.dumps(sys.stdin.read()))')
PAYLOAD="{\"subject\":\"\u274C[CI/CD-Automation] [${ACCELERATOR_NAME}] Deployment-Failed\",\"body\":${BODY_JSON}}"
curl -X POST "${LOGICAPP_URL}" \
-H "Content-Type: application/json" \
-d "$PAYLOAD" || echo "Failed to send deployment failure notification"
# ------------------------------------------------------------------
# Success (deploy + optional E2E)
# ------------------------------------------------------------------
- name: Send Success Notification
if: inputs.deploy_result == 'success' && (inputs.e2e_test_result == 'skipped' || inputs.TEST_SUCCESS == 'true')
shell: bash
env:
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_RUN_ID: ${{ github.run_id }}
INPUT_CONTAINER_WEB_APPURL: ${{ inputs.CONTAINER_WEB_APPURL }}
INPUT_EXISTING_WEBAPP_URL: ${{ inputs.existing_webapp_url }}
INPUT_RESOURCE_GROUP_NAME: ${{ inputs.RESOURCE_GROUP_NAME }}
INPUT_TEST_REPORT_URL: ${{ inputs.TEST_REPORT_URL }}
INPUT_E2E_TEST_RESULT: ${{ inputs.e2e_test_result }}
ACCELERATOR_NAME: ${{ env.accelerator_name }}
LOGICAPP_URL: ${{ secrets.EMAILNOTIFICATION_LOGICAPP_URL_TA }}
CONFIG_LABEL: ${{ steps.config.outputs.CONFIG_LABEL }}
CLEANUP_PILL: ${{ steps.cleanup.outputs.CLEANUP_PILL }}
TEST_SUITE_NAME: ${{ steps.test_suite.outputs.TEST_SUITE_NAME }}
run: |
# HTML-escape values that get embedded into the email template to avoid HTML/attribute injection from workflow inputs.
html_escape() {
printf '%s' "$1" | sed -e 's/&/\&/g' -e 's/</\</g' -e 's/>/\>/g' -e 's/"/\"/g' -e "s/'/\'/g"
}
RUN_URL="https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
WEBAPP_URL="$(html_escape "${INPUT_CONTAINER_WEB_APPURL:-$INPUT_EXISTING_WEBAPP_URL}")"
RESOURCE_GROUP="$(html_escape "$INPUT_RESOURCE_GROUP_NAME")"
TEST_REPORT_URL="$(html_escape "$INPUT_TEST_REPORT_URL")"
PILL_BASE="display:inline-block; min-width:70px; text-align:center; padding:4px 12px; border-radius:20px; font-size:12px; font-weight:600; line-height:1.4;"
DEPLOY_PILL="<span style=\"${PILL_BASE} background:#d4edda; color:#155724;\">✅ SUCCESS</span>"
if [ "$INPUT_E2E_TEST_RESULT" = "skipped" ]; then
E2E_PILL="<span style=\"${PILL_BASE} background:#d4edda; color:#155724;\">⏭️ SKIPPED</span>"
INTRO="The <strong>${ACCELERATOR_NAME}</strong> deployment has completed successfully."
TEST_DETAIL_ROWS=""
else
E2E_PILL="<span style=\"${PILL_BASE} background:#d4edda; color:#155724;\">✅ SUCCESS</span>"
INTRO="The <strong>${ACCELERATOR_NAME}</strong> deployment and test automation has completed successfully."
TEST_DETAIL_ROWS="<tr><td style=\"padding:8px 0; font-size:13px; color:#6b7280;\">Test Suite</td><td style=\"padding:8px 0; font-size:13px; color:#111827;\">${TEST_SUITE_NAME}</td></tr><tr><td style=\"padding:8px 0; font-size:13px; color:#6b7280;\">Test Report</td><td style=\"padding:8px 0; font-size:13px;\"><a href=\"${TEST_REPORT_URL}\" style=\"color:#2563eb; text-decoration:none;\">📄 View Report</a></td></tr>"
fi
BODY_HTML=$(cat <<HTML
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" style="background-color:#ffffff; padding:40px 20px; font-family:'Segoe UI',Tahoma,Geneva,Verdana,sans-serif;">
<tr><td align="center">
<table role="presentation" width="800" cellpadding="0" cellspacing="0" style="background-color:#ffffff; border:1px solid #e5e7eb; border-radius:8px; overflow:hidden; box-shadow:0 1px 3px rgba(0,0,0,0.08);">
<tr><td style="background-color:#10b981; padding:24px 40px;">
<table width="100%" cellpadding="0" cellspacing="0"><tr>
<td><h1 style="margin:0; color:#ffffff; font-size:20px; font-weight:700;">Pipeline Succeeded</h1>
<p style="margin:6px 0 0; color:rgba(255,255,255,0.9); font-size:13px;">${ACCELERATOR_NAME} Accelerator • CI/CD Automation</p></td>
<td align="right" style="vertical-align:middle;">
<span style="background:rgba(255,255,255,0.2); color:#fff; padding:6px 14px; border-radius:4px; font-size:12px; font-weight:600;">${CONFIG_LABEL}</span>
</td>
</tr></table>
</td></tr>
<tr><td style="padding:32px 40px;">
<p style="color:#374151; font-size:14px; line-height:1.7; margin:0 0 28px;">Dear Team,<br>${INTRO}</p>
<div style="background:#f8f9fb; border-radius:8px; padding:20px; margin-bottom:24px;">
<h3 style="margin:0 0 16px; color:#1a1a2e; font-size:14px; text-transform:uppercase; letter-spacing:0.5px;">Status Summary</h3>
<table width="100%" cellpadding="0" cellspacing="0" style="font-size:14px;">
<tr><td style="padding:10px 0; border-bottom:1px solid #e8eaed; color:#5f6368;">Deployment</td><td align="right" style="padding:10px 0; border-bottom:1px solid #e8eaed;">${DEPLOY_PILL}</td></tr>
<tr><td style="padding:10px 0; border-bottom:1px solid #e8eaed; color:#5f6368;">E2E Tests</td><td align="right" style="padding:10px 0; border-bottom:1px solid #e8eaed;">${E2E_PILL}</td></tr>
<tr><td style="padding:10px 0; color:#5f6368;">Cleanup</td><td align="right" style="padding:10px 0;">${CLEANUP_PILL}</td></tr>
</table>
</div>
<h3 style="margin:0 0 14px; font-size:13px; text-transform:uppercase; letter-spacing:0.5px; color:#6b7280; border-bottom:2px solid #e5e7eb; padding-bottom:8px;">Deployment Details</h3>
<table width="100%" cellpadding="0" cellspacing="0" style="margin-bottom:28px;">
<tr><td style="padding:8px 0; font-size:13px; color:#6b7280; width:140px;">Resource Group</td>
<td style="padding:8px 0; font-size:13px; color:#111827; font-family:'Cascadia Code','Courier New',monospace;">${RESOURCE_GROUP}</td></tr>
<tr><td style="padding:8px 0; font-size:13px; color:#6b7280;">Web App URL</td>
<td style="padding:8px 0; font-size:13px;"><a href="${WEBAPP_URL}" style="color:#2563eb; text-decoration:none; font-family:'Cascadia Code','Courier New',monospace;">${WEBAPP_URL}</a></td></tr>
<tr><td style="padding:8px 0; font-size:13px; color:#6b7280;">Triggered By</td>
<td style="padding:8px 0; font-size:13px; color:#111827;">${{ github.actor }}</td></tr>
<tr><td style="padding:8px 0; font-size:13px; color:#6b7280;">Branch</td>
<td style="padding:8px 0; font-size:13px; color:#111827; font-family:'Cascadia Code','Courier New',monospace;">${{ env.BRANCH_NAME }}</td></tr>
${TEST_DETAIL_ROWS}
</table>
<table role="presentation" width="100%" cellpadding="0" cellspacing="0"><tr><td align="center" style="padding:8px 0;">
<a href="${RUN_URL}" style="display:inline-block; background:#111827; color:#ffffff; text-decoration:none; padding:12px 28px; border-radius:4px; font-size:13px; font-weight:600; letter-spacing:0.3px;">VIEW PIPELINE RUN</a>
</td></tr></table>
</td></tr>
<tr><td style="background:#f9fafb; padding:20px 40px; border-top:1px solid #e5e7eb;">
<table width="100%" cellpadding="0" cellspacing="0"><tr>
<td style="font-size:11px; color:#9ca3af;">CI/CD Automation Pipeline</td>
<td align="right" style="font-size:11px; color:#9ca3af;">${ACCELERATOR_NAME} Accelerator</td>
</tr></table>
</td></tr>
</table>
</td></tr>
</table>
HTML
)
BODY_JSON=$(printf '%s' "$BODY_HTML" | python3 -c 'import json,sys; print(json.dumps(sys.stdin.read()))')
PAYLOAD="{\"subject\":\"\u2705[CI/CD-Automation] [${ACCELERATOR_NAME}] Success\",\"body\":${BODY_JSON}}"
curl -X POST "${LOGICAPP_URL}" \
-H "Content-Type: application/json" \
-d "$PAYLOAD" || echo "Failed to send success notification"
# ------------------------------------------------------------------
# E2E test failure (deploy succeeded)
# ------------------------------------------------------------------
- name: Send Test Failure Notification
if: inputs.deploy_result == 'success' && inputs.e2e_test_result != 'skipped' && inputs.TEST_SUCCESS != 'true'
shell: bash
env:
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_RUN_ID: ${{ github.run_id }}
INPUT_CONTAINER_WEB_APPURL: ${{ inputs.CONTAINER_WEB_APPURL }}
INPUT_EXISTING_WEBAPP_URL: ${{ inputs.existing_webapp_url }}
INPUT_RESOURCE_GROUP_NAME: ${{ inputs.RESOURCE_GROUP_NAME }}
INPUT_TEST_REPORT_URL: ${{ inputs.TEST_REPORT_URL }}
ACCELERATOR_NAME: ${{ env.accelerator_name }}
LOGICAPP_URL: ${{ secrets.EMAILNOTIFICATION_LOGICAPP_URL_TA }}
CLEANUP_PILL: ${{ steps.cleanup.outputs.CLEANUP_PILL }}
CONFIG_LABEL: ${{ steps.config.outputs.CONFIG_LABEL }}
TEST_SUITE_NAME: ${{ steps.test_suite.outputs.TEST_SUITE_NAME }}
run: |
# HTML-escape values that get embedded into the email template to avoid HTML/attribute injection from workflow inputs.
html_escape() {
printf '%s' "$1" | sed -e 's/&/\&/g' -e 's/</\</g' -e 's/>/\>/g' -e 's/"/\"/g' -e "s/'/\'/g"
}
RUN_URL="https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
WEBAPP_URL="$(html_escape "${INPUT_CONTAINER_WEB_APPURL:-$INPUT_EXISTING_WEBAPP_URL}")"
RESOURCE_GROUP="$(html_escape "$INPUT_RESOURCE_GROUP_NAME")"
TEST_REPORT_URL="$(html_escape "$INPUT_TEST_REPORT_URL")"
PILL_BASE="display:inline-block; min-width:70px; text-align:center; padding:4px 12px; border-radius:20px; font-size:12px; font-weight:600; line-height:1.4;"
DEPLOY_PILL="<span style=\"${PILL_BASE} background:#d4edda; color:#155724;\">✅ SUCCESS</span>"
E2E_PILL="<span style=\"${PILL_BASE} background:#f8d7da; color:#721c24;\">❌ FAILED</span>"
BODY_HTML=$(cat <<HTML
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" style="background-color:#ffffff; padding:40px 20px; font-family:'Segoe UI',Tahoma,Geneva,Verdana,sans-serif;">
<tr><td align="center">
<table role="presentation" width="800" cellpadding="0" cellspacing="0" style="background-color:#ffffff; border:1px solid #e5e7eb; border-radius:8px; overflow:hidden; box-shadow:0 1px 3px rgba(0,0,0,0.08);">
<tr><td style="background-color:#ef4444; padding:24px 40px;">
<table width="100%" cellpadding="0" cellspacing="0"><tr>
<td><h1 style="margin:0; color:#ffffff; font-size:20px; font-weight:700;">E2E Tests Failed</h1>
<p style="margin:6px 0 0; color:rgba(255,255,255,0.9); font-size:13px;">${ACCELERATOR_NAME} Accelerator • CI/CD Automation</p></td>
<td align="right" style="vertical-align:middle;">
<span style="background:rgba(255,255,255,0.2); color:#fff; padding:6px 14px; border-radius:4px; font-size:12px; font-weight:600;">${CONFIG_LABEL}</span>
</td>
</tr></table>
</td></tr>
<tr><td style="padding:32px 40px;">
<p style="color:#374151; font-size:14px; line-height:1.7; margin:0 0 28px;">Dear Team,<br>The <strong>${ACCELERATOR_NAME}</strong> test automation has <span style="color:#dc2626; font-weight:700;">failed</span>. Please investigate at your earliest convenience.</p>
<div style="background:#f8f9fb; border-radius:8px; padding:20px; margin-bottom:24px;">
<h3 style="margin:0 0 16px; color:#1a1a2e; font-size:14px; text-transform:uppercase; letter-spacing:0.5px;">Status Summary</h3>
<table width="100%" cellpadding="0" cellspacing="0" style="font-size:14px;">
<tr><td style="padding:10px 0; border-bottom:1px solid #e8eaed; color:#5f6368;">Deployment</td><td align="right" style="padding:10px 0; border-bottom:1px solid #e8eaed;">${DEPLOY_PILL}</td></tr>
<tr><td style="padding:10px 0; border-bottom:1px solid #e8eaed; color:#5f6368;">E2E Tests</td><td align="right" style="padding:10px 0; border-bottom:1px solid #e8eaed;">${E2E_PILL}</td></tr>
<tr><td style="padding:10px 0; color:#5f6368;">Cleanup</td><td align="right" style="padding:10px 0;">${CLEANUP_PILL}</td></tr>
</table>
</div>
<h3 style="margin:0 0 14px; font-size:13px; text-transform:uppercase; letter-spacing:0.5px; color:#6b7280; border-bottom:2px solid #e5e7eb; padding-bottom:8px;">Deployment Details</h3>
<table width="100%" cellpadding="0" cellspacing="0" style="margin-bottom:28px;">
<tr><td style="padding:8px 0; font-size:13px; color:#6b7280; width:140px;">Resource Group</td>
<td style="padding:8px 0; font-size:13px; color:#111827; font-family:'Cascadia Code','Courier New',monospace;">${RESOURCE_GROUP}</td></tr>
<tr><td style="padding:8px 0; font-size:13px; color:#6b7280;">Web App URL</td>
<td style="padding:8px 0; font-size:13px;"><a href="${WEBAPP_URL}" style="color:#2563eb; text-decoration:none; font-family:'Cascadia Code','Courier New',monospace;">${WEBAPP_URL}</a></td></tr>
<tr><td style="padding:8px 0; font-size:13px; color:#6b7280;">Triggered By</td>
<td style="padding:8px 0; font-size:13px; color:#111827;">${{ github.actor }}</td></tr>
<tr><td style="padding:8px 0; font-size:13px; color:#6b7280;">Branch</td>
<td style="padding:8px 0; font-size:13px; color:#111827; font-family:'Cascadia Code','Courier New',monospace;">${{ env.BRANCH_NAME }}</td></tr>
<tr><td style="padding:8px 0; font-size:13px; color:#6b7280;">Test Suite</td>
<td style="padding:8px 0; font-size:13px; color:#111827;">${TEST_SUITE_NAME}</td></tr>
<tr><td style="padding:8px 0; font-size:13px; color:#6b7280;">Test Report</td>
<td style="padding:8px 0; font-size:13px;"><a href="${TEST_REPORT_URL}" style="color:#2563eb; text-decoration:none;">📄 View Report</a></td></tr>
</table>
<table role="presentation" width="100%" cellpadding="0" cellspacing="0"><tr><td align="center" style="padding:8px 0;">
<a href="${RUN_URL}" style="display:inline-block; background:#dc2626; color:#ffffff; text-decoration:none; padding:12px 28px; border-radius:4px; font-size:13px; font-weight:600; letter-spacing:0.3px;">INVESTIGATE FAILURE</a>
</td></tr></table>
</td></tr>
<tr><td style="background:#f9fafb; padding:20px 40px; border-top:1px solid #e5e7eb;">
<table width="100%" cellpadding="0" cellspacing="0"><tr>
<td style="font-size:11px; color:#9ca3af;">CI/CD Automation Pipeline</td>
<td align="right" style="font-size:11px; color:#9ca3af;">${ACCELERATOR_NAME} Accelerator</td>
</tr></table>
</td></tr>
</table>
</td></tr>
</table>
HTML
)
BODY_JSON=$(printf '%s' "$BODY_HTML" | python3 -c 'import json,sys; print(json.dumps(sys.stdin.read()))')
PAYLOAD="{\"subject\":\"\u274C[CI/CD-Automation] [${ACCELERATOR_NAME}] E2E Test-Failed\",\"body\":${BODY_JSON}}"
curl -X POST "${LOGICAPP_URL}" \
-H "Content-Type: application/json" \
-d "$PAYLOAD" || echo "Failed to send test failure notification"
# ------------------------------------------------------------------
# Existing URL: success
# ------------------------------------------------------------------
- name: Send Existing URL Success Notification
if: inputs.deploy_result == 'skipped' && inputs.existing_webapp_url != '' && inputs.e2e_test_result == 'success' && (inputs.TEST_SUCCESS == 'true' || inputs.TEST_SUCCESS == '')
shell: bash
env:
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_RUN_ID: ${{ github.run_id }}
INPUT_EXISTING_WEBAPP_URL: ${{ inputs.existing_webapp_url }}
INPUT_TEST_REPORT_URL: ${{ inputs.TEST_REPORT_URL }}
ACCELERATOR_NAME: ${{ env.accelerator_name }}
LOGICAPP_URL: ${{ secrets.EMAILNOTIFICATION_LOGICAPP_URL_TA }}
CLEANUP_PILL: ${{ steps.cleanup.outputs.CLEANUP_PILL }}
CONFIG_LABEL: ${{ steps.config.outputs.CONFIG_LABEL }}
TEST_SUITE_NAME: ${{ steps.test_suite.outputs.TEST_SUITE_NAME }}
run: |
# HTML-escape values that get embedded into the email template to avoid HTML/attribute injection from workflow inputs.
html_escape() {
printf '%s' "$1" | sed -e 's/&/\&/g' -e 's/</\</g' -e 's/>/\>/g' -e 's/"/\"/g' -e "s/'/\'/g"
}
RUN_URL="https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
EXISTING_URL="$(html_escape "$INPUT_EXISTING_WEBAPP_URL")"
TEST_REPORT_URL="$(html_escape "$INPUT_TEST_REPORT_URL")"
PILL_BASE="display:inline-block; min-width:70px; text-align:center; padding:4px 12px; border-radius:20px; font-size:12px; font-weight:600; line-height:1.4;"
DEPLOY_PILL="<span style=\"${PILL_BASE} background:#d4edda; color:#155724;\">⏭️ SKIPPED</span>"
E2E_PILL="<span style=\"${PILL_BASE} background:#d4edda; color:#155724;\">✅ SUCCESS</span>"
if [ -n "$TEST_REPORT_URL" ]; then
REPORT_ROW="<tr><td style=\"padding:8px 0; font-size:13px; color:#6b7280;\">Test Report</td><td style=\"padding:8px 0; font-size:13px;\"><a href=\"${TEST_REPORT_URL}\" style=\"color:#2563eb; text-decoration:none;\">📄 View Report</a></td></tr>"
else
REPORT_ROW=""
fi
BODY_HTML=$(cat <<HTML
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" style="background-color:#ffffff; padding:40px 20px; font-family:'Segoe UI',Tahoma,Geneva,Verdana,sans-serif;">
<tr><td align="center">
<table role="presentation" width="800" cellpadding="0" cellspacing="0" style="background-color:#ffffff; border:1px solid #e5e7eb; border-radius:8px; overflow:hidden; box-shadow:0 1px 3px rgba(0,0,0,0.08);">
<tr><td style="background-color:#10b981; padding:24px 40px;">
<table width="100%" cellpadding="0" cellspacing="0"><tr>
<td><h1 style="margin:0; color:#ffffff; font-size:20px; font-weight:700;">Pipeline Succeeded</h1>
<p style="margin:6px 0 0; color:rgba(255,255,255,0.9); font-size:13px;">${ACCELERATOR_NAME} Accelerator • CI/CD Automation</p></td>
<td align="right" style="vertical-align:middle;">
<span style="background:rgba(255,255,255,0.2); color:#fff; padding:6px 14px; border-radius:4px; font-size:12px; font-weight:600;">${CONFIG_LABEL}</span>
</td>
</tr></table>
</td></tr>
<tr><td style="padding:32px 40px;">
<p style="color:#374151; font-size:14px; line-height:1.7; margin:0 0 28px;">Dear Team,<br>The <strong>${ACCELERATOR_NAME}</strong> pipeline executed against the specified Target URL and test automation has completed successfully.</p>
<div style="background:#f8f9fb; border-radius:8px; padding:20px; margin-bottom:24px;">
<h3 style="margin:0 0 16px; color:#1a1a2e; font-size:14px; text-transform:uppercase; letter-spacing:0.5px;">Status Summary</h3>
<table width="100%" cellpadding="0" cellspacing="0" style="font-size:14px;">
<tr><td style="padding:10px 0; border-bottom:1px solid #e8eaed; color:#5f6368;">Deployment</td><td align="right" style="padding:10px 0; border-bottom:1px solid #e8eaed;">${DEPLOY_PILL}</td></tr>
<tr><td style="padding:10px 0; border-bottom:1px solid #e8eaed; color:#5f6368;">E2E Tests</td><td align="right" style="padding:10px 0; border-bottom:1px solid #e8eaed;">${E2E_PILL}</td></tr>
<tr><td style="padding:10px 0; color:#5f6368;">Cleanup</td><td align="right" style="padding:10px 0;">${CLEANUP_PILL}</td></tr>
</table>
</div>
<h3 style="margin:0 0 14px; font-size:13px; text-transform:uppercase; letter-spacing:0.5px; color:#6b7280; border-bottom:2px solid #e5e7eb; padding-bottom:8px;">Test Results</h3>
<table width="100%" cellpadding="0" cellspacing="0" style="margin-bottom:28px;">
<tr><td style="padding:8px 0; font-size:13px; color:#6b7280; width:140px;">Target URL</td>
<td style="padding:8px 0; font-size:13px;"><a href="${EXISTING_URL}" style="color:#2563eb; text-decoration:none; font-family:'Cascadia Code','Courier New',monospace;">${EXISTING_URL}</a></td></tr>
<tr><td style="padding:8px 0; font-size:13px; color:#6b7280;">Triggered By</td>
<td style="padding:8px 0; font-size:13px; color:#111827;">${{ github.actor }}</td></tr>
<tr><td style="padding:8px 0; font-size:13px; color:#6b7280;">Branch</td>
<td style="padding:8px 0; font-size:13px; color:#111827; font-family:'Cascadia Code','Courier New',monospace;">${{ env.BRANCH_NAME }}</td></tr>
<tr><td style="padding:8px 0; font-size:13px; color:#6b7280;">Test Suite</td>
<td style="padding:8px 0; font-size:13px; color:#111827;">${TEST_SUITE_NAME}</td></tr>
${REPORT_ROW}
</table>
<table role="presentation" width="100%" cellpadding="0" cellspacing="0"><tr><td align="center" style="padding:8px 0;">
<a href="${RUN_URL}" style="display:inline-block; background:#111827; color:#ffffff; text-decoration:none; padding:12px 28px; border-radius:4px; font-size:13px; font-weight:600; letter-spacing:0.3px;">VIEW PIPELINE RUN</a>
</td></tr></table>
</td></tr>
<tr><td style="background:#f9fafb; padding:20px 40px; border-top:1px solid #e5e7eb;">
<table width="100%" cellpadding="0" cellspacing="0"><tr>
<td style="font-size:11px; color:#9ca3af;">CI/CD Automation Pipeline</td>
<td align="right" style="font-size:11px; color:#9ca3af;">${ACCELERATOR_NAME} Accelerator</td>
</tr></table>
</td></tr>
</table>
</td></tr>
</table>
HTML
)
BODY_JSON=$(printf '%s' "$BODY_HTML" | python3 -c 'import json,sys; print(json.dumps(sys.stdin.read()))')
PAYLOAD="{\"subject\":\"\u2705[CI/CD-Automation] [${ACCELERATOR_NAME}] Success\",\"body\":${BODY_JSON}}"
curl -X POST "${LOGICAPP_URL}" \
-H "Content-Type: application/json" \
-d "$PAYLOAD" || echo "Failed to send existing URL success notification"
# ------------------------------------------------------------------
# Existing URL: test failure
# ------------------------------------------------------------------
- name: Send Existing URL Test Failure Notification
if: inputs.deploy_result == 'skipped' && inputs.existing_webapp_url != '' && inputs.e2e_test_result == 'failure'
shell: bash
env:
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_RUN_ID: ${{ github.run_id }}
INPUT_EXISTING_WEBAPP_URL: ${{ inputs.existing_webapp_url }}
INPUT_TEST_REPORT_URL: ${{ inputs.TEST_REPORT_URL }}
ACCELERATOR_NAME: ${{ env.accelerator_name }}
LOGICAPP_URL: ${{ secrets.EMAILNOTIFICATION_LOGICAPP_URL_TA }}
CLEANUP_PILL: ${{ steps.cleanup.outputs.CLEANUP_PILL }}
CONFIG_LABEL: ${{ steps.config.outputs.CONFIG_LABEL }}
TEST_SUITE_NAME: ${{ steps.test_suite.outputs.TEST_SUITE_NAME }}
run: |
# HTML-escape values that get embedded into the email template to avoid HTML/attribute injection from workflow inputs.
html_escape() {
printf '%s' "$1" | sed -e 's/&/\&/g' -e 's/</\</g' -e 's/>/\>/g' -e 's/"/\"/g' -e "s/'/\'/g"
}
RUN_URL="https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
EXISTING_URL="$(html_escape "$INPUT_EXISTING_WEBAPP_URL")"
TEST_REPORT_URL="$(html_escape "$INPUT_TEST_REPORT_URL")"
PILL_BASE="display:inline-block; min-width:70px; text-align:center; padding:4px 12px; border-radius:20px; font-size:12px; font-weight:600; line-height:1.4;"
DEPLOY_PILL="<span style=\"${PILL_BASE} background:#d4edda; color:#155724;\">⏭️ SKIPPED</span>"
E2E_PILL="<span style=\"${PILL_BASE} background:#f8d7da; color:#721c24;\">❌ FAILED</span>"
if [ -n "$TEST_REPORT_URL" ]; then
REPORT_ROW="<tr><td style=\"padding:8px 0; font-size:13px; color:#6b7280;\">Test Report</td><td style=\"padding:8px 0; font-size:13px;\"><a href=\"${TEST_REPORT_URL}\" style=\"color:#2563eb; text-decoration:none;\">📄 View Report</a></td></tr>"
else
REPORT_ROW=""
fi
BODY_HTML=$(cat <<HTML
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" style="background-color:#ffffff; padding:40px 20px; font-family:'Segoe UI',Tahoma,Geneva,Verdana,sans-serif;">
<tr><td align="center">
<table role="presentation" width="800" cellpadding="0" cellspacing="0" style="background-color:#ffffff; border:1px solid #e5e7eb; border-radius:8px; overflow:hidden; box-shadow:0 1px 3px rgba(0,0,0,0.08);">
<tr><td style="background-color:#ef4444; padding:24px 40px;">
<table width="100%" cellpadding="0" cellspacing="0"><tr>
<td><h1 style="margin:0; color:#ffffff; font-size:20px; font-weight:700;">E2E Tests Failed</h1>
<p style="margin:6px 0 0; color:rgba(255,255,255,0.9); font-size:13px;">${ACCELERATOR_NAME} Accelerator • CI/CD Automation</p></td>
<td align="right" style="vertical-align:middle;">
<span style="background:rgba(255,255,255,0.2); color:#fff; padding:6px 14px; border-radius:4px; font-size:12px; font-weight:600;">${CONFIG_LABEL}</span>
</td>
</tr></table>
</td></tr>
<tr><td style="padding:32px 40px;">
<p style="color:#374151; font-size:14px; line-height:1.7; margin:0 0 28px;">Dear Team,<br>The <strong>${ACCELERATOR_NAME}</strong> pipeline executed against the specified Target URL and test automation has <span style="color:#dc2626; font-weight:700;">failed</span>.</p>
<div style="background:#f8f9fb; border-radius:8px; padding:20px; margin-bottom:24px;">
<h3 style="margin:0 0 16px; color:#1a1a2e; font-size:14px; text-transform:uppercase; letter-spacing:0.5px;">Status Summary</h3>
<table width="100%" cellpadding="0" cellspacing="0" style="font-size:14px;">
<tr><td style="padding:10px 0; border-bottom:1px solid #e8eaed; color:#5f6368;">Deployment</td><td align="right" style="padding:10px 0; border-bottom:1px solid #e8eaed;">${DEPLOY_PILL}</td></tr>
<tr><td style="padding:10px 0; border-bottom:1px solid #e8eaed; color:#5f6368;">E2E Tests</td><td align="right" style="padding:10px 0; border-bottom:1px solid #e8eaed;">${E2E_PILL}</td></tr>
<tr><td style="padding:10px 0; color:#5f6368;">Cleanup</td><td align="right" style="padding:10px 0;">${CLEANUP_PILL}</td></tr>
</table>
</div>
<h3 style="margin:0 0 14px; font-size:13px; text-transform:uppercase; letter-spacing:0.5px; color:#6b7280; border-bottom:2px solid #e5e7eb; padding-bottom:8px;">Failure Details</h3>
<table width="100%" cellpadding="0" cellspacing="0" style="margin-bottom:28px;">
<tr><td style="padding:8px 0; font-size:13px; color:#6b7280; width:140px;">Target URL</td>
<td style="padding:8px 0; font-size:13px;"><a href="${EXISTING_URL}" style="color:#2563eb; text-decoration:none; font-family:'Cascadia Code','Courier New',monospace;">${EXISTING_URL}</a></td></tr>
<tr><td style="padding:8px 0; font-size:13px; color:#6b7280;">Triggered By</td>
<td style="padding:8px 0; font-size:13px; color:#111827;">${{ github.actor }}</td></tr>
<tr><td style="padding:8px 0; font-size:13px; color:#6b7280;">Branch</td>
<td style="padding:8px 0; font-size:13px; color:#111827; font-family:'Cascadia Code','Courier New',monospace;">${{ env.BRANCH_NAME }}</td></tr>
<tr><td style="padding:8px 0; font-size:13px; color:#6b7280;">Test Suite</td>
<td style="padding:8px 0; font-size:13px; color:#111827;">${TEST_SUITE_NAME}</td></tr>
${REPORT_ROW}
</table>
<table role="presentation" width="100%" cellpadding="0" cellspacing="0"><tr><td align="center" style="padding:8px 0;">
<a href="${RUN_URL}" style="display:inline-block; background:#dc2626; color:#ffffff; text-decoration:none; padding:12px 28px; border-radius:4px; font-size:13px; font-weight:600; letter-spacing:0.3px;">INVESTIGATE FAILURE</a>
</td></tr></table>
</td></tr>
<tr><td style="background:#f9fafb; padding:20px 40px; border-top:1px solid #e5e7eb;">
<table width="100%" cellpadding="0" cellspacing="0"><tr>
<td style="font-size:11px; color:#9ca3af;">CI/CD Automation Pipeline</td>
<td align="right" style="font-size:11px; color:#9ca3af;">${ACCELERATOR_NAME} Accelerator</td>
</tr></table>
</td></tr>
</table>
</td></tr>
</table>
HTML
)
BODY_JSON=$(printf '%s' "$BODY_HTML" | python3 -c 'import json,sys; print(json.dumps(sys.stdin.read()))')
PAYLOAD="{\"subject\":\"\u274C[CI/CD-Automation] [${ACCELERATOR_NAME}] E2E Test-Failed\",\"body\":${BODY_JSON}}"
curl -X POST "${LOGICAPP_URL}" \
-H "Content-Type: application/json" \
-d "$PAYLOAD" || echo "Failed to send existing URL test failure notification"