@@ -813,6 +813,10 @@ jobs:
813813 EOF
814814 )
815815
816+ echo "===== DEBUG: Quota Failure EMAIL_BODY (raw JSON) ====="
817+ printf '%s\n' "$EMAIL_BODY"
818+ echo "====================================================="
819+
816820 curl -X POST "${{ secrets.LOGIC_APP_URL }}" \
817821 -H "Content-Type: application/json" \
818822 -d "$EMAIL_BODY" || echo "Failed to send quota failure notification"
@@ -830,6 +834,9 @@ jobs:
830834 }
831835 EOF
832836 )
837+ echo "===== DEBUG: Deployment Failure EMAIL_BODY (raw JSON) ====="
838+ printf '%s\n' "$EMAIL_BODY"
839+ echo "=========================================================="
833840
834841 curl -X POST "${{ secrets.LOGIC_APP_URL }}" \
835842 -H "Content-Type: application/json" \
@@ -857,6 +864,9 @@ jobs:
857864 }
858865 EOF
859866 )
867+ echo "===== DEBUG: Success EMAIL_BODY (raw JSON) ====="
868+ printf '%s\n' "$EMAIL_BODY"
869+ echo "==============================================="
860870
861871 curl -X POST "${{ secrets.LOGIC_APP_URL }}" \
862872 -H "Content-Type: application/json" \
@@ -878,9 +888,59 @@ jobs:
878888 EOF
879889 )
880890
891+ echo "===== DEBUG: Test Failure EMAIL_BODY (raw JSON) ====="
892+ printf '%s\n' "$EMAIL_BODY"
893+ echo "===================================================="
894+
881895 curl -X POST "${{ secrets.EMAILNOTIFICATION_LOGICAPP_URL_TA }}" \
882896 -H "Content-Type: application/json" \
883897 -d "$EMAIL_BODY" || echo "Failed to send test failure notification"
898+
899+ - name : Send Existing URL Success Notification
900+ # Scenario: Deployment skipped (existing URL provided) AND e2e tests passed
901+ if : needs.deploy.result == 'skipped' && github.event.inputs.existing_webapp_url != '' && needs.e2e-test.result == 'success' && (needs.e2e-test.outputs.TEST_SUCCESS == 'true' || needs.e2e-test.outputs.TEST_SUCCESS == '')
902+ run : |
903+ RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
904+ EXISTING_URL="${{ github.event.inputs.existing_webapp_url }}"
905+ TEST_REPORT_URL="${{ needs.e2e-test.outputs.TEST_REPORT_URL }}"
906+ EMAIL_BODY=$(cat <<EOF
907+ {
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>Build 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"
910+ }
911+ EOF
912+ )
913+
914+ echo "===== DEBUG: Existing URL Success EMAIL_BODY (raw JSON) ====="
915+ printf '%s\n' "$EMAIL_BODY"
916+ echo "==========================================================="
917+
918+ curl -X POST "${{ secrets.LOGIC_APP_URL }}" \
919+ -H "Content-Type: application/json" \
920+ -d "$EMAIL_BODY" || echo "Failed to send existing URL success notification"
921+
922+ - name : Send Existing URL Test Failure Notification
923+ # Scenario: Deployment skipped (existing URL provided) AND e2e tests failed
924+ if : needs.deploy.result == 'skipped' && github.event.inputs.existing_webapp_url != '' && needs.e2e-test.result == 'failure'
925+ run : |
926+ RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
927+ EXISTING_URL="${{ github.event.inputs.existing_webapp_url }}"
928+ TEST_REPORT_URL="${{ needs.e2e-test.outputs.TEST_REPORT_URL }}"
929+ EMAIL_BODY=$(cat <<EOF
930+ {
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>Build 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"
933+ }
934+ EOF
935+ )
936+
937+ echo "===== DEBUG: Existing URL Failure EMAIL_BODY (raw JSON) ====="
938+ printf '%s\n' "$EMAIL_BODY"
939+ echo "==========================================================="
940+
941+ curl -X POST "${{ secrets.EMAILNOTIFICATION_LOGICAPP_URL_TA }}" \
942+ -H "Content-Type: application/json" \
943+ -d "$EMAIL_BODY" || echo "Failed to send existing URL test failure notification"
884944
885945 - name : Generate Notification Job Summary
886946 if : always()
@@ -926,6 +986,10 @@ jobs:
926986 echo "- **E2E Test Job**: ${{ needs.e2e-test.result == 'success' && '✅ Success' || needs.e2e-test.result == 'failure' && '❌ Failed' || '⏸️ Skipped' }}" >> $GITHUB_STEP_SUMMARY
927987 echo "- **Test Results**: ${{ needs.e2e-test.outputs.TEST_SUCCESS == 'true' && '✅ Passed' || needs.e2e-test.outputs.TEST_SUCCESS == 'false' && '❌ Failed' || '⏸️ Not Run' }}" >> $GITHUB_STEP_SUMMARY
928988 echo "- **Quota Status**: ${{ needs.deploy.outputs.QUOTA_FAILED == 'true' && '❌ Quota Failed' || '✅ Quota OK' }}" >> $GITHUB_STEP_SUMMARY
989+ if [[ "${{ needs.deploy.result }}" == "skipped" && "${{ github.event.inputs.existing_webapp_url }}" != "" ]]; then
990+ echo "- **Mode**: Existing URL (deployment skipped)" >> $GITHUB_STEP_SUMMARY
991+ echo "- **Target URL**: ${{ github.event.inputs.existing_webapp_url }}" >> $GITHUB_STEP_SUMMARY
992+ fi
929993 echo "" >> $GITHUB_STEP_SUMMARY
930994 echo "### 🔗 Links" >> $GITHUB_STEP_SUMMARY
931995 echo "- **Pipeline Run**: [View Details](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})" >> $GITHUB_STEP_SUMMARY
0 commit comments