Skip to content

Commit 35ffb68

Browse files
committed
ping #tabs-vs-spaces channel on e2e test failures
1 parent ba6cda7 commit 35ffb68

1 file changed

Lines changed: 28 additions & 1 deletion

File tree

.github/workflows/e2e.yml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,31 @@ jobs:
5959
- name: Run E2E tests
6060
env:
6161
CODEPLAIN_API_KEY: ${{ secrets.CODEPLAIN_API_KEY }}
62-
run: pytest tests/e2e/ -v --tb=short
62+
run: pytest tests/e2e/ -v --tb=short
63+
64+
notify-on-failure:
65+
name: Notify Slack on failure
66+
needs: [e2e-linux, e2e-windows]
67+
if: failure()
68+
runs-on: ubuntu-latest
69+
env:
70+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_E2E_WEBHOOK_URL }}
71+
steps:
72+
- name: Determine failed platforms
73+
id: platforms
74+
run: |
75+
failed=""
76+
[ "${{ needs.e2e-linux.result }}" = "failure" ] && failed="Linux"
77+
if [ "${{ needs.e2e-windows.result }}" = "failure" ]; then
78+
[ -n "$failed" ] && failed="$failed and Windows" || failed="Windows"
79+
fi
80+
echo "failed=$failed" >> "$GITHUB_OUTPUT"
81+
82+
- name: Send failure notification to Slack
83+
if: ${{ env.SLACK_WEBHOOK_URL != '' }}
84+
uses: slackapi/slack-github-action@v1.24.0
85+
with:
86+
payload: |
87+
{
88+
"text": ${{ toJSON(format('[Codeplain Client] E2E tests FAILED on {0}. See <{1}/{2}/actions/runs/{3}|the run log>.', steps.platforms.outputs.failed, github.server_url, github.repository, github.run_id)) }}
89+
}

0 commit comments

Comments
 (0)