Skip to content

Commit e03023b

Browse files
committed
ci: only notify Slack on drift detection or failure, not on clean runs
1 parent 98b3b5f commit e03023b

1 file changed

Lines changed: 13 additions & 14 deletions

File tree

.github/workflows/test-drift.yml

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,22 +67,21 @@ jobs:
6767
if-no-files-found: warn
6868
retention-days: 30
6969

70-
- name: Notify Slack
71-
if: always()
70+
- name: Notify Slack on drift or failure
71+
if: always() && job.status != 'success'
7272
run: |
73-
if [ "${{ steps.drift.outputs.exit_code }}" = "2" ]; then
74-
EMOJI="🚨"
75-
MSG="*Drift detected* in aimock — providers changed response formats. <https://github.com/CopilotKit/aimock/actions/runs/${{ github.run_id }}|View run>"
76-
elif [ "${{ job.status }}" = "success" ]; then
77-
EMOJI="✅"
78-
MSG="Drift tests passed — all providers match."
79-
else
80-
EMOJI="❌"
81-
MSG="*Drift tests failed* (infra error). <https://github.com/CopilotKit/aimock/actions/runs/${{ github.run_id }}|View run>"
73+
if [ -n "${{ secrets.SLACK_WEBHOOK }}" ]; then
74+
if [ "${{ steps.drift.outputs.exit_code }}" = "2" ]; then
75+
EMOJI="🚨"
76+
MSG="*Drift detected* in aimock — providers changed response formats. <https://github.com/CopilotKit/aimock/actions/runs/${{ github.run_id }}|View run>"
77+
else
78+
EMOJI="❌"
79+
MSG="*Drift tests failed* (infra error). <https://github.com/CopilotKit/aimock/actions/runs/${{ github.run_id }}|View run>"
80+
fi
81+
curl -s -X POST "${{ secrets.SLACK_WEBHOOK }}" \
82+
-H "Content-Type: application/json" \
83+
-d "{\"text\": \"${EMOJI} ${MSG}\"}"
8284
fi
83-
curl -s -X POST "${{ secrets.SLACK_WEBHOOK }}" \
84-
-H "Content-Type: application/json" \
85-
-d "{\"text\": \"${EMOJI} ${MSG}\"}"
8685
env:
8786
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
8887

0 commit comments

Comments
 (0)