DEV Community

Cover image for GitHub Actions push on your phone with Pocket Alert
Pocket Alert
Pocket Alert

Posted on

GitHub Actions push on your phone with Pocket Alert

You already get email when a workflow fails. Half the time you notice it late, after someone asks why the deploy is stuck.

This setup uses the official GitHub Action so a fail or success hits your iPhone or Android as a push. One secret, a couple of steps, done.

Pocket Alert is a push service for developers. Free plan: 50 messages/day. Apps on iOS and Android.

What you need

  1. A Pocket Alert account
  2. The mobile app installed and signed in (iOS · Android)
  3. A GitHub repo where you can add Actions secrets

Optional: create an application in the dashboard so this repo has its own channel.

Step 1: Token as a repo secret

In Pocket Alert, create an API token: https://pocketalert.app/account/apikeys

Copy it once.

In GitHub: Settings → Secrets and variables → Actions → New repository secret

  • Name: POCKET_ALERT_TOKEN
  • Value: your token

Do not put the token in the workflow file. Always pass ${{ secrets.POCKET_ALERT_TOKEN }}.

Step 2: Notify with the official action

Use PocketAlert/notification-action@v1.0.0. Put notify steps after the work you care about. Separate failure and success so the wording stays clear.

- name: Notify on failure
  if: failure()
  uses: PocketAlert/notification-action@v1.0.0
  with:
    token: ${{ secrets.POCKET_ALERT_TOKEN }}
    title: "Build failed"
    message: "${{ github.workflow }} on ${{ github.ref_name }} (${{ github.sha }})"

- name: Notify on success
  if: success()
  uses: PocketAlert/notification-action@v1.0.0
  with:
    token: ${{ secrets.POCKET_ALERT_TOKEN }}
    title: "Deploy succeeded"
    message: "${{ github.repository }}@${{ github.sha }}"
Enter fullscreen mode Exit fullscreen mode

Inputs: token, title, message (required). Optional: application_id, device_id.

Step 3: Full minimal workflow

name: CI

on:
  push:
    branches: [main]
  pull_request:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Build
        run: echo "your real build here"

      - name: Notify on failure
        if: failure()
        uses: PocketAlert/notification-action@v1.0.0
        with:
          token: ${{ secrets.POCKET_ALERT_TOKEN }}
          title: "CI failed"
          message: "${{ github.repository }} · ${{ github.workflow }} · ${{ github.sha }}"

      - name: Notify on success
        if: success()
        uses: PocketAlert/notification-action@v1.0.0
        with:
          token: ${{ secrets.POCKET_ALERT_TOKEN }}
          title: "CI passed"
          message: "${{ github.repository }}@${{ github.sha }}"
Enter fullscreen mode Exit fullscreen mode

Push a commit, break the build once, confirm the phone buzzes. Then fix the job and confirm success.

Optional: route to one application

In the dashboard, open Applications and copy the id. Pass it as application_id so frontend, backend, and release stays in separate channels you can mute.

with:
  token: ${{ secrets.POCKET_ALERT_TOKEN }}
  title: "Release shipped"
  message: "${{ github.repository }} ${{ github.ref_name }}"
  application_id: "YOUR_APP_ID"
Enter fullscreen mode Exit fullscreen mode

Fallback: raw curl (API)

Prefer the action when you can. Use curl if you need fields the action does not expose yet (for example priority level), or you are debugging the API itself.

- name: Notify on failure (curl)
  if: failure()
  run: |
    curl -X POST "https://api.pocketalert.app/v1/messages" \
      -H "Token: ${{ secrets.POCKET_ALERT_TOKEN }}" \
      -H "Content-Type: application/json" \
      -d '{"title":"Build failed","message":"${{ github.workflow }} on ${{ github.ref_name }}","level":"high"}'
Enter fullscreen mode Exit fullscreen mode

Docs: https://info.pocketalert.app/getting-started.html

Same secret name works. Header is still Token: ….

Tips

Notify last. If the step runs before a failing step, you never get the fail push.

Include context. github.repository, github.sha, github.workflow, github.ref_name beat a bare “failed”.

Start free. 50 messages/day is enough to try the habit: https://pocketalert.app

Wrap-up

Add POCKET_ALERT_TOKEN, drop in PocketAlert/notification-action@v1.0.0 on failure and success, run the workflow once. That is the whole onboarding.

Install the app first if you have not: iOS · Android

Action: https://github.com/PocketAlert/notification-action

Guide: https://pocketalert.app/use-cases/github-actions-alerts

Top comments (0)