Skip to content

Commit a637567

Browse files
Refactor notification email subject and body
1 parent 49addf4 commit a637567

1 file changed

Lines changed: 22 additions & 17 deletions

File tree

.github/workflows/deploy-Parameterized.yml

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ jobs:
807807
RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
808808
EMAIL_BODY=$(cat <<EOF
809809
{
810-
"body": "<p>Dear Team,</p><p>We would like to inform you that the DocGen deployment has failed due to insufficient quota in the requested regions.</p><p><strong>Issue Details:</strong><br>• Quota check failed for GPT and Text Embedding models<br>• Required GPT Capacity: ${{ env.GPT_MIN_CAPACITY }}<br>• Required Text Embedding Capacity: ${{ env.TEXT_EMBEDDING_MIN_CAPACITY }}<br>• Checked Regions: ${{ vars.AZURE_REGIONS }}</p><p><strong>Action Required:</strong><br>• Increase quota limits in Azure portal<br>• Or select a different region with available quota</p><p><strong>Run URL:</strong> <a href='${RUN_URL}'>${RUN_URL}</a></p><p>Please resolve the quota issue and retry the deployment.</p><p>Best regards,<br>Your Automation Team</p>",
810+
"body": "<p>Dear Team,</p><p>We would like to inform you that the DocGen deployment has failed due to insufficient quota in the requested regions.</p><p><strong>Issue Details:</strong><br>• Quota check failed for GPT and Text Embedding models<br>• Required GPT Capacity: ${{ env.GPT_MIN_CAPACITY }}<br>• Required Text Embedding Capacity: ${{ env.TEXT_EMBEDDING_MIN_CAPACITY }}<br>• Checked Regions: ${{ vars.AZURE_REGIONS }}</p><p><strong>Run URL:</strong> <a href='${RUN_URL}'>${RUN_URL}</a></p><p>Please resolve the quota issue and retry the deployment.</p><p>Best regards,<br>Your Automation Team</p>",
811811
"subject": "DocGen Pipeline - Failed (Insufficient Quota)"
812812
}
813813
EOF
@@ -830,7 +830,7 @@ jobs:
830830
EMAIL_BODY=$(cat <<EOF
831831
{
832832
"body": "<p>Dear Team,</p><p>We would like to inform you that the DocGen deployment process has encountered an issue and has failed to complete successfully.</p><p><strong>Deployment Details:</strong><br>• Resource Group: ${RESOURCE_GROUP}<br>• WAF Enabled: ${{ env.WAF_ENABLED }}<br>• EXP Enabled: ${{ env.EXP }}</p><p><strong>Run URL:</strong> <a href='${RUN_URL}'>${RUN_URL}</a></p><p>Please investigate the deployment failure at your earliest convenience.</p><p>Best regards,<br>Your Automation Team</p>",
833-
"subject": "DocGen Deployment - Failed"
833+
"subject": "DocGen Pipeline - Failed"
834834
}
835835
EOF
836836
)
@@ -850,20 +850,25 @@ jobs:
850850
RESOURCE_GROUP="${{ needs.deploy.outputs.RESOURCE_GROUP_NAME }}"
851851
TEST_REPORT_URL="${{ needs.e2e-test.outputs.TEST_REPORT_URL }}"
852852
853-
# Determine test status message
853+
# Create email body based on test result
854854
if [ "${{ needs.e2e-test.result }}" = "skipped" ]; then
855-
TEST_STATUS_MSG="• E2E Tests: Skipped (as configured)"
855+
EMAIL_BODY=$(cat <<EOF
856+
{
857+
"body": "<p>Dear Team,</p><p>We would like to inform you that the DocGen deployment has completed successfully.</p><p><strong>Deployment Details:</strong><br>• Resource Group: ${RESOURCE_GROUP}<br>• Web App URL: <a href='${WEBAPP_URL}'>${WEBAPP_URL}</a><br>• E2E Tests: Skipped (as configured)</p><p><strong>Configuration:</strong><br>• WAF Enabled: ${{ env.WAF_ENABLED }}<br>• EXP Enabled: ${{ env.EXP }}</p><p><strong>Run URL:</strong> <a href='${RUN_URL}'>${RUN_URL}</a></p><p>Best regards,<br>Your Automation Team</p>",
858+
"subject": "DocGen Pipeline - Deployment Success"
859+
}
860+
EOF
861+
)
856862
else
857-
TEST_STATUS_MSG="• E2E Tests: Passed<br>• Test Report: <a href='${TEST_REPORT_URL}'>View Report</a>"
858-
fi
859-
860-
EMAIL_BODY=$(cat <<EOF
863+
EMAIL_BODY=$(cat <<EOF
861864
{
862-
"body": "<p>Dear Team,</p><p>We would like to inform you that the DocGen deployment and testing process has completed successfully.</p><p><strong>Deployment Details:</strong><br>• Resource Group: ${RESOURCE_GROUP}<br>• Web App URL: <a href='${WEBAPP_URL}'>${WEBAPP_URL}</a><br>${TEST_STATUS_MSG}</p><p><strong>Configuration:</strong><br>• WAF Enabled: ${{ env.WAF_ENABLED }}<br>• EXP Enabled: ${{ env.EXP }}</p><p><strong>Run URL:</strong> <a href='${RUN_URL}'>${RUN_URL}</a></p><p>The application is now ready for use.</p><p>Best regards,<br>Your Automation Team</p>",
863-
"subject": "DocGen Pipeline - Success"
865+
"body": "<p>Dear Team,</p><p>We would like to inform you that the DocGen deployment and testing process has completed successfully.</p><p><strong>Deployment Details:</strong><br>• Resource Group: ${RESOURCE_GROUP}<br>• Web App URL: <a href='${WEBAPP_URL}'>${WEBAPP_URL}</a><br>• E2E Tests: Passed<br>• Test Report: <a href='${TEST_REPORT_URL}'>View Report</a></p><p><strong>Configuration:</strong><br>• WAF Enabled: ${{ env.WAF_ENABLED }}<br>• EXP Enabled: ${{ env.EXP }}</p><p><strong>Run URL:</strong> <a href='${RUN_URL}'>${RUN_URL}</a></p><p>Best regards,<br>Your Automation Team</p>",
866+
"subject": "DocGen Pipeline - Test Automation - Success"
864867
}
865868
EOF
866-
)
869+
)
870+
fi
871+
867872
echo "===== DEBUG: Success EMAIL_BODY (raw JSON) ====="
868873
printf '%s\n' "$EMAIL_BODY"
869874
echo "==============================================="
@@ -882,8 +887,8 @@ jobs:
882887
883888
EMAIL_BODY=$(cat <<EOF
884889
{
885-
"body": "<p>Dear Team,</p><p>We would like to inform you that while the DocGen deployment was successful, the E2E test automation process has encountered issues and failed to complete successfully.</p><p><strong>Deployment Details:</strong><br>• Resource Group: ${RESOURCE_GROUP}<br>• Web App URL: <a href='${WEBAPP_URL}'>${WEBAPP_URL}</a><br>• Deployment Status: ✅ Success<br>• E2E Tests: ❌ Failed</p><p><strong>Test Details:</strong><br>• Test Report: <a href='${TEST_REPORT_URL}'>View Report</a></p><p><strong>Run URL:</strong> <a href='${RUN_URL}'>${RUN_URL}</a></p><p>The application has been deployed successfully, but please investigate the test failures to ensure functionality.</p><p>Best regards,<br>Your Automation Team</p>",
886-
"subject": "DocGen Pipeline - Deployment Success, Tests Failed"
890+
"body": "<p>Dear Team,</p><p>We would like to inform you that test automation process has encountered issues and failed to complete successfully.</p><p><strong>Deployment Details:</strong><br>• Resource Group: ${RESOURCE_GROUP}<br>• Web App URL: <a href='${WEBAPP_URL}'>${WEBAPP_URL}</a><br>• Deployment Status: ✅ Success<br>• E2E Tests: ❌ Failed</p><p><strong>Test Details:</strong><br>• Test Report: <a href='${TEST_REPORT_URL}'>View Report</a></p><p><strong>Run URL:</strong> <a href='${RUN_URL}'>${RUN_URL}</a></p><p>Please investigate the matter at your earliest convenience.</p><p>Best regards,<br>Your Automation Team</p>",
891+
"subject": "DocGen Pipeline - Test Automation - Failed"
887892
}
888893
EOF
889894
)
@@ -905,8 +910,8 @@ jobs:
905910
TEST_REPORT_URL="${{ needs.e2e-test.outputs.TEST_REPORT_URL }}"
906911
EMAIL_BODY=$(cat <<EOF
907912
{
908-
"body": "<p>Dear Team,</p><p>The DocGen pipeline executed against the <strong>existing WebApp URL</strong> you supplied and the E2E tests completed successfully.</p><p><strong>Test Results:</strong><br>• Status: ✅ Passed<br>${TEST_REPORT_URL:+• Test Report: <a href='${TEST_REPORT_URL}'>View Report</a>}<br>• Target URL: <a href='${EXISTING_URL}'>${EXISTING_URL}</a></p><p><strong>Deployment:</strong> Skipped (existing URL reuse)</p><p><strong>Run URL:</strong> <a href='${RUN_URL}'>${RUN_URL}</a></p><p>No infrastructure changes were made.</p><p>Best regards,<br>Your Automation Team</p>",
909-
"subject": "DocGen Pipeline - Existing URL Tests Passed"
913+
"body": "<p>Dear Team,</p><p>The DocGen pipeline executed against the <strong>existing WebApp URL</strong> and testing process has completed successfully.</p><p><strong>Test Results:</strong><br>• Status: ✅ Passed<br>${TEST_REPORT_URL:+• Test Report: <a href='${TEST_REPORT_URL}'>View Report</a>}<br>• Target URL: <a href='${EXISTING_URL}'>${EXISTING_URL}</a></p><p><strong>Deployment:</strong> Skipped</p><p><strong>Run URL:</strong> <a href='${RUN_URL}'>${RUN_URL}</a></p><p>Best regards,<br>Your Automation Team</p>",
914+
"subject": "DocGen Pipeline - Test Automation Passed (Existing URL)"
910915
}
911916
EOF
912917
)
@@ -928,8 +933,8 @@ jobs:
928933
TEST_REPORT_URL="${{ needs.e2e-test.outputs.TEST_REPORT_URL }}"
929934
EMAIL_BODY=$(cat <<EOF
930935
{
931-
"body": "<p>Dear Team,</p><p>The DocGen pipeline targeted the <strong>existing WebApp URL</strong> you supplied. Deployment was intentionally skipped, but the E2E tests have <strong>failed</strong>.</p><p><strong>Failure Details:</strong><br>• Target URL: <a href='${EXISTING_URL}'>${EXISTING_URL}</a><br>${TEST_REPORT_URL:+• Test Report: <a href='${TEST_REPORT_URL}'>View Report</a>}<br>• Deployment: Skipped (existing URL reuse)</p><p><strong>Recommended Actions:</strong><br>• Inspect the failing test cases<br>• Verify application availability and recent changes<br>• Re-run tests after fixes</p><p><strong>Run URL:</strong> <a href='${RUN_URL}'>${RUN_URL}</a></p><p>Best regards,<br>Your Automation Team</p>",
932-
"subject": "DocGen Pipeline - Existing URL Tests Failed"
936+
"body": "<p>Dear Team,</p><p>The DocGen pipeline executed against the <strong>existing WebApp URL</strong> and the test automation has encountered issues and failed to complete successfully.</p><p><strong>Failure Details:</strong><br>• Target URL: <a href='${EXISTING_URL}'>${EXISTING_URL}</a><br>${TEST_REPORT_URL:+• Test Report: <a href='${TEST_REPORT_URL}'>View Report</a>}<br>• Deployment: Skipped</p><p><strong>Run URL:</strong> <a href='${RUN_URL}'>${RUN_URL}</a></p><p>Best regards,<br>Your Automation Team</p>",
937+
"subject": "DocGen Pipeline - Test Automation Failed (Existing URL)"
933938
}
934939
EOF
935940
)

0 commit comments

Comments
 (0)