Alert on a failed CI job
Send a BotPings iPhone alert when a GitHub Actions or GitLab CI check fails. Keep the key in CI secrets and confirm the alert on a test run.
GitHub Actions · GitLab CI · 3 min · Servers and scripts
Before you start
Create a key for your test channel. Save it as the BOTPINGS_KEY secret or as a masked CI variable. Untrusted fork jobs should not receive the secret.
Steps
Create a reusable alert step
Save this as ci/botpings-failure.sh. The body can use a generic title that contains no repository data.
curl -fsS --max-time 15 https://botpings.com/send \
-H "Authorization: Bearer $BOTPINGS_KEY" \
-H "Content-Type: application/json" \
-d '{"title":"CI checks failed","priority":"high"}'Run only on failure in GitHub Actions
Include a step in the job with if: failure() and run: sh ci/botpings-failure.sh. Set BOTPINGS_KEY in that step’s environment from its Actions secret.
Run only on failure in GitLab CI
Add an alert job in a later stage with when: on_failure. Run sh ci/botpings-failure.sh and make the masked variable available to that job.
Test it
In a branch and demo channel, intentionally fail a small check. Confirm a single alert reaches Inbox and a passing run leaves it quiet.
If it doesn’t work
- The alert step didn’t run. Confirm the triggering job actually failed.
- The key is empty. Check secret permissions and protected branch or fork restrictions.
- Multiple alerts arrived. Use one alert job or a consistent dedupeKey for the same incident.
Related guides
Checked with BotPings 1.0 in a local test environment, November 2026.