Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 50 additions & 7 deletions .github/workflows/testsPython.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,54 @@ jobs:
notifications:
needs: python-unit-tests
runs-on: ubuntu-latest
if: always() # ← ensures this job runs even when tests fail
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 Slack on success
if: needs.python-unit-tests.result == 'success'
uses: slackapi/slack-github-action@v1.27.0
with:
payload: |
{
"text": "*Tests Passed!*",
"attachments": [
{
"color": "#36A64F",
"fields": [
{ "title": "Repository", "value": "${{ github.repository }}", "short": true },
{ "title": "Branch", "value": "${{ github.ref_name }}", "short": true },
{ "title": "Python Version", "value": "${{ env.python-version }}", "short": true },
{ "title": "Triggered by", "value": "${{ github.actor }}", "short": true },
{ "title": "Commit", "value": "${{ github.sha }}", "short": false },
{ "title": "View Run", "value": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}", "short": false }
]
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK

- name: Notify Slack on failure
if: needs.python-unit-tests.result != 'success'
uses: slackapi/slack-github-action@v1.27.0
with:
payload: |
{
"text": "*Tests Failed!*",
"attachments": [
{
"color": "#FF0000",
"fields": [
{ "title": "Repository", "value": "${{ github.repository }}", "short": true },
{ "title": "Branch", "value": "${{ github.ref_name }}", "short": true },
{ "title": "Python Version", "value": "${{ env.python-version }}", "short": true },
{ "title": "Triggered by", "value": "${{ github.actor }}", "short": true },
{ "title": "Commit", "value": "${{ github.sha }}", "short": false },
{ "title": "View Run", "value": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}", "short": false }
]
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK