From af236d78d0858228a97f152541843b15275da906 Mon Sep 17 00:00:00 2001 From: Yong Chen Date: Mon, 4 May 2026 12:17:13 -0700 Subject: [PATCH 1/4] Python unit tests notification in GitHub Action and by email using Brevo. --- .github/workflows/testsPython.yml | 34 ++++++++++++++++++++++++++++-- agentic-ai-workflow.code-workspace | 7 ++++++ 2 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 agentic-ai-workflow.code-workspace diff --git a/.github/workflows/testsPython.yml b/.github/workflows/testsPython.yml index 452f71d..099d4b1 100644 --- a/.github/workflows/testsPython.yml +++ b/.github/workflows/testsPython.yml @@ -68,12 +68,42 @@ jobs: # on the test results. notifications: needs: python-unit-tests + if: always() runs-on: ubuntu-latest steps: + # Notifications in GitHub Actions - name: Notify on test results run: | if [ "${{ needs.python-unit-tests.result }}" == "success" ]; then - echo "success notifications go here" + echo "Tests passed ✅" else - echo "failure notifications go here" + echo "Tests failed ❌" fi + # Email notification using Brevo when tests pass, BREVO_API_KEY is set in repository secrets + - name: Send success email + if: ${{ needs.python-unit-tests.result == 'success' }} + run: | + curl -X POST https://api.brevo.com/v3/smtp/email \ + -H "accept: application/json" \ + -H "api-key: ${{ secrets.BREVO_API_KEY }}" \ + -H "content-type: application/json" \ + -d '{ + "sender": { "email": "yongchuangchen@gmail.com" }, + "to": [{ "email": "chenyongchuang@hotmail.com" }], + "subject": "Tests Passed ✅", + "htmlContent": "

All tests passed successfully.

" + }' + # Email notification using Brevo when tests fail, BREVO_API_KEY is set in repository secrets + - name: Send failure email + if: ${{ needs.python-unit-tests.result == 'failure' }} + run: | + curl -X POST https://api.brevo.com/v3/smtp/email \ + -H "accept: application/json" \ + -H "api-key: ${{ secrets.BREVO_API_KEY }}" \ + -H "content-type: application/json" \ + -d '{ + "sender": { "email": "yongchuangchen@gmail.com" }, + "to": [{ "email": "chenyongchuang@hotmail.com" }], + "subject": "Tests Failed ❌", + "htmlContent": "

Tests failed. Check logs in GitHub Actions.

" + }' diff --git a/agentic-ai-workflow.code-workspace b/agentic-ai-workflow.code-workspace new file mode 100644 index 0000000..ef9f5d2 --- /dev/null +++ b/agentic-ai-workflow.code-workspace @@ -0,0 +1,7 @@ +{ + "folders": [ + { + "path": "." + } + ] +} \ No newline at end of file From 320a6caed265163979b275c749fcb6ee7ba0c54c Mon Sep 17 00:00:00 2001 From: Yong Chen Date: Mon, 4 May 2026 12:36:23 -0700 Subject: [PATCH 2/4] Use a DMARC configured Sender in Brevo to make sure email notifications can be successfully delivered. --- .github/workflows/testsPython.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/testsPython.yml b/.github/workflows/testsPython.yml index 099d4b1..946e098 100644 --- a/.github/workflows/testsPython.yml +++ b/.github/workflows/testsPython.yml @@ -88,7 +88,7 @@ jobs: -H "api-key: ${{ secrets.BREVO_API_KEY }}" \ -H "content-type: application/json" \ -d '{ - "sender": { "email": "yongchuangchen@gmail.com" }, + "sender": { "email": "info@runningresults.net" }, "to": [{ "email": "chenyongchuang@hotmail.com" }], "subject": "Tests Passed ✅", "htmlContent": "

All tests passed successfully.

" @@ -102,7 +102,7 @@ jobs: -H "api-key: ${{ secrets.BREVO_API_KEY }}" \ -H "content-type: application/json" \ -d '{ - "sender": { "email": "yongchuangchen@gmail.com" }, + "sender": { "email": "info@runningresults.net" }, "to": [{ "email": "chenyongchuang@hotmail.com" }], "subject": "Tests Failed ❌", "htmlContent": "

Tests failed. Check logs in GitHub Actions.

" From 6b9cf5473e8a9a277c76cc63d7a1f9b275b4f664 Mon Sep 17 00:00:00 2001 From: Yong Chen Date: Mon, 4 May 2026 12:52:28 -0700 Subject: [PATCH 3/4] Change notification recipient's email to from Hotmail to Gmail. Notification emails received successfully. --- .github/workflows/testsPython.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/testsPython.yml b/.github/workflows/testsPython.yml index 946e098..37a8834 100644 --- a/.github/workflows/testsPython.yml +++ b/.github/workflows/testsPython.yml @@ -89,7 +89,7 @@ jobs: -H "content-type: application/json" \ -d '{ "sender": { "email": "info@runningresults.net" }, - "to": [{ "email": "chenyongchuang@hotmail.com" }], + "to": [{ "email": "yongchuangchen@gmail.com" }], "subject": "Tests Passed ✅", "htmlContent": "

All tests passed successfully.

" }' @@ -103,7 +103,7 @@ jobs: -H "content-type: application/json" \ -d '{ "sender": { "email": "info@runningresults.net" }, - "to": [{ "email": "chenyongchuang@hotmail.com" }], + "to": [{ "email": "yongchuangchen@gmail.com" }], "subject": "Tests Failed ❌", "htmlContent": "

Tests failed. Check logs in GitHub Actions.

" }' From d9b38c5f23c0c8f0a5c73de96cb48f4151733189 Mon Sep 17 00:00:00 2001 From: Yong Chen Date: Mon, 4 May 2026 13:08:57 -0700 Subject: [PATCH 4/4] Notifications in Job Summary panel of the workflow run --- .github/workflows/testsPython.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/testsPython.yml b/.github/workflows/testsPython.yml index 37a8834..f5b3744 100644 --- a/.github/workflows/testsPython.yml +++ b/.github/workflows/testsPython.yml @@ -71,13 +71,15 @@ jobs: if: always() runs-on: ubuntu-latest steps: - # Notifications in GitHub Actions + # Notifications in Job Summary panel of the workflow run - name: Notify on test results run: | if [ "${{ needs.python-unit-tests.result }}" == "success" ]; then - echo "Tests passed ✅" + echo "## Tests Passed ✅" >> $GITHUB_STEP_SUMMARY + echo "All unit tests succeeded." >> $GITHUB_STEP_SUMMARY else - echo "Tests failed ❌" + echo "## Tests Failed ❌" >> $GITHUB_STEP_SUMMARY + echo "Check logs for details." >> $GITHUB_STEP_SUMMARY fi # Email notification using Brevo when tests pass, BREVO_API_KEY is set in repository secrets - name: Send success email