CI/CD
Add nudge notifications to GitHub Actions, GitLab CI, and other CI/CD pipelines.
GitHub Actions
Add a nudge step after your deploy job to get notified the moment a workflow finishes. Store your API token as a repository secret named NUDGE_TOKEN.
name: Deploy
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Deploy to production
run: ./deploy.sh
# Notify on success
- name: Nudge -- deployed
if: success()
run: |
curl -s https://nudge.sh/${{{ secrets.NUDGE_TOKEN }}} \
-d status="deployed" \
-d label="${{{ github.repository }}}"
# Notify on failure
- name: Nudge -- failed
if: failure()
run: |
curl -s https://nudge.sh/${{{ secrets.NUDGE_TOKEN }}} \
-d status="failed" \
-d label="${{{ github.repository }}}"If you want a single notification regardless of outcome, use if: always() and pass the job status:
- name: Nudge -- notify
if: always()
run: |
curl -s https://nudge.sh/${{{ secrets.NUDGE_TOKEN }}} \
-d status="${{{ job.status }}}" \
-d label="${{{ github.repository }}}"Go to your repository Settings → Secrets and variables → Actions and add NUDGE_TOKEN as a repository secret. It will be available as ${{{ secrets.NUDGE_TOKEN }}} in all workflows.
GitLab CI
In GitLab CI, use after_script to send a nudge after your deploy job completes. Store your token as a CI/CD variable named NUDGE_TOKEN.
deploy:
stage: deploy
script:
- ./deploy.sh
after_script:
- |
if [ $CI_JOB_STATUS == "success" ]; then
STATUS="deployed"
else
STATUS="failed"
fi
curl -s https://nudge.sh/$NUDGE_TOKEN \
-d status="$STATUS" \
-d label="$CI_PROJECT_PATH"
only:
- mainAdd NUDGE_TOKEN under Settings → CI/CD → Variables. Mark it as Masked so it does not appear in job logs. The built-in $CI_JOB_STATUS variable gives you the job outcome in after_script.
Generic CI
The pattern works in any CI system -- Jenkins, CircleCI, Bitbucket Pipelines, Travis, or a custom runner. The steps are always the same:
- Store your token as a secret -- every CI platform has a way to set masked environment variables.
- Add a curl step after your deploy or test command -- one line is all it takes.
# Generic post-deploy nudge
curl -s https://nudge.sh/$NUDGE_TOKEN \
-d status="deployed" \
-d label="my-app"Always store NUDGE_TOKEN as a secret or masked variable in your CI platform. Never commit it to your repository or paste it directly into pipeline config files.
Failure Notifications
Sometimes you only want a nudge when something goes wrong. Capture the exit code and send conditionally:
# Only nudge on failure
./deploy.sh
EXIT_CODE=$?
if [ $EXIT_CODE -ne 0 ]; then
curl -s https://nudge.sh/$NUDGE_TOKEN \
-d status="failed" \
-d exit_code=$EXIT_CODE \
-d label="deploy"
fi
# Preserve the original exit code for the CI runner
exit $EXIT_CODEIn GitHub Actions, use separate steps with if: failure() to achieve the same thing declaratively:
- name: Deploy
run: ./deploy.sh
- name: Nudge on failure only
if: failure()
run: |
curl -s https://nudge.sh/${{{ secrets.NUDGE_TOKEN }}} \
-d status="failed" \
-d label="${{{ github.repository }}}"