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 }}