Docs Ping PingArk from GitHub Actions

Ping PingArk from GitHub Actions

A scheduled GitHub Actions workflow can silently stop running, for example when GitHub disables cron on a repository with no recent activity. Add a ping step at the end of the job, and PingArk alerts you the moment the schedule stops firing.

Before you start

You need a check and its ping URL. Create one in the dashboard, then copy the ping URL from the check page. For a private ping URL, store it as a repository secret and read it with ${{ secrets.PINGARK_URL }} rather than hard coding it in the workflow file. New to PingArk? Start with the getting started guide.

Ping on success

Call the ping URL after your job finishes its work. A plain ping means success and re-arms the check for its next run.

# .github/workflows/backup.yml
name: Nightly backup
on:
  schedule:
    - cron: '0 2 * * *'
jobs:
  backup:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Run the job
        run: ./backup.sh
      - name: Ping PingArk
        run: curl -fsS -m 10 --retry 3 https://ping.pingark.com/ping/3f9c2a1b-7d4e-4c8a-9f1b-2e6d8a0c4b5e
Copy

Report failures, starts and duration

Add a suffix to the ping URL to say more than a plain success. Call these the same way you called the success URL above. The ping API has the full reference.

https://ping.pingark.com/ping/3f9c2a1b-7d4e-4c8a-9f1b-2e6d8a0c4b5e        # success: the job finished, re-arms the timer
https://ping.pingark.com/ping/3f9c2a1b-7d4e-4c8a-9f1b-2e6d8a0c4b5e/start  # the run started, lets PingArk measure duration
https://ping.pingark.com/ping/3f9c2a1b-7d4e-4c8a-9f1b-2e6d8a0c4b5e/fail   # an explicit failure, alerts right away
https://ping.pingark.com/ping/3f9c2a1b-7d4e-4c8a-9f1b-2e6d8a0c4b5e/log    # a timeline note, never alerts
https://ping.pingark.com/ping/3f9c2a1b-7d4e-4c8a-9f1b-2e6d8a0c4b5e/$?     # a shell exit code: 0 is success, anything else fails
Copy

Put the ping in its own final step so it runs only after the real work has succeeded. If an earlier step fails, the workflow stops before the ping and PingArk raises an alert.

To alert on a failed run as well as a missed one, add an if: failure() step that pings the /fail URL, so a failure reports down straight away.

Troubleshooting

  • GitHub disables scheduled workflows on public repositories after 60 days without a commit. PingArk is what tells you this has happened.
  • Scheduled runs use the workflow file on the default branch, so a schedule change only takes effect once it is merged there.