From 7fd04bd77ccb5303b8e85f69541e7a58aca18e2e Mon Sep 17 00:00:00 2001 From: dkayiwa Date: Fri, 27 Feb 2026 12:01:11 +0300 Subject: [PATCH] Add email notification on workflow failure The Bamboo spec notified dev-refapp@openmrs.org on plan completion and committers on failure. This adds a notify job that emails dev-refapp@openmrs.org when any job fails. Requires SMTP secrets: SMTP_SERVER, SMTP_PORT, SMTP_USERNAME, SMTP_PASSWORD. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/build-deploy-release.yml | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.github/workflows/build-deploy-release.yml b/.github/workflows/build-deploy-release.yml index 09377e74..ef0526ca 100644 --- a/.github/workflows/build-deploy-release.yml +++ b/.github/workflows/build-deploy-release.yml @@ -129,3 +129,29 @@ jobs: GIT_USER_EMAIL: info@openmrs.org MAVEN_REPO_USERNAME: ${{ secrets.MAVEN_REPO_USERNAME }} MAVEN_REPO_API_KEY: ${{ secrets.MAVEN_REPO_API_KEY }} + + notify: + name: Notify on failure + needs: [build, deploy, release] + if: always() && contains(needs.*.result, 'failure') + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - name: Send failure email + uses: dawidd6/action-send-mail@v3 + with: + server_address: ${{ secrets.SMTP_SERVER }} + server_port: ${{ secrets.SMTP_PORT }} + username: ${{ secrets.SMTP_USERNAME }} + password: ${{ secrets.SMTP_PASSWORD }} + subject: "[${{ github.repository }}] Workflow failed: ${{ github.workflow }} (#${{ github.run_number }})" + to: dev-refapp@openmrs.org + from: openmrs-ci@openmrs.org + body: | + Workflow "${{ github.workflow }}" failed in ${{ github.repository }}. + + Branch: ${{ github.ref_name }} + Commit: ${{ github.sha }} + Triggered by: ${{ github.actor }} + + View the run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}