diff --git a/.github/workflows/testsPython.yml b/.github/workflows/testsPython.yml index 452f71d..583822f 100644 --- a/.github/workflows/testsPython.yml +++ b/.github/workflows/testsPython.yml @@ -34,7 +34,7 @@ on: env: python-version: "3.13" - + # define run environment jobs: # Job #1: Run Python unit tests # @@ -70,10 +70,36 @@ 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: 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: Notify Discord on failure + if: always() + run: | + curl -H "Content-Type: application/json" \ + -X POST \ + -d '{ + "embeds": [{ + "title": "❌ CI Build Failed", + "color": 15548997, + "fields": [ + {"name": "Repository", "value": "'"$REPO"'", "inline": true}, + {"name": "Branch", "value": "'"$BRANCH"'", "inline": true}, + {"name": "Commit", "value": "'"$SHA"'", "inline": false}, + {"name": "Triggered by", "value": "'"$ACTOR"'","inline": true}, + {"name": "Logs", "value": "[View run]('"$LOGS_URL"')", "inline": false} + ] + }] + }' \ + "$DISCORD_WEBHOOK_URL" + env: + DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} + REPO: ${{ github.repository }} + BRANCH: ${{ github.ref_name }} + SHA: ${{ github.sha }} + ACTOR: ${{ github.actor }} + LOGS_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}