Merge pull request #3712 from jackwilsdon/zulip-notifications

Notify Zulip chat on integration test failure
This commit is contained in:
Jack Wilsdon 2020-08-02 16:06:23 +01:00 committed by GitHub
commit 6e4207f35a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -26,3 +26,20 @@ jobs:
- name: Test with tox
run: |
tox -e int
- name: Notify on failure
if: ${{ failure() }}
env:
ZULIP_BOT_CREDENTIALS: ${{ secrets.ZULIP_BOT_CREDENTIALS }}
run: |
if [ -z "${ZULIP_BOT_CREDENTIALS}" ]; then
echo "Skipping notify, ZULIP_BOT_CREDENTIALS is unset"
exit 0
fi
curl -X POST https://beets.zulipchat.com/api/v1/messages \
-u "${ZULIP_BOT_CREDENTIALS}" \
-d "type=stream" \
-d "to=github" \
-d "subject=${GITHUB_WORKFLOW} - $(date -u +%Y-%m-%d)" \
-d "content=[${GITHUB_WORKFLOW}#${GITHUB_RUN_NUMBER}](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}) failed."