diff --git a/.github/workflows/testsPython.yml b/.github/workflows/testsPython.yml index 452f71d..534a379 100644 --- a/.github/workflows/testsPython.yml +++ b/.github/workflows/testsPython.yml @@ -70,10 +70,28 @@ jobs: needs: python-unit-tests runs-on: ubuntu-latest steps: - - name: Notify on test results - run: | - if [ "${{ needs.python-unit-tests.result }}" == "success" ]; then - echo "success notifications go here" - else - echo "failure notifications go here" - fi + - name: Send success email + if: needs.python-unit-tests.result == 'success' + 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: 'Python Unit Tests Successful in ${{ github.repository }}' + body: 'The unit tests have passed successfully. View the results: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}' + to: ${{ secrets.EMAIL_TO }} + from: ${{ secrets.EMAIL_FROM }} + + - name: Send failure email + if: needs.python-unit-tests.result == 'failure' + 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: 'Python Unit Tests Failed in ${{ github.repository }}' + body: 'The unit tests have failed. Please check the logs: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}' + to: ${{ secrets.EMAIL_TO }} + from: ${{ secrets.EMAIL_FROM }}