Skip to content

feat(monitoring): alert when GitHub stops running a scheduled workflow - #1847

Merged
Gerrrt merged 1 commit into
mainfrom
gerrrt/workflow-heartbeat
Nov 29, 2026
Merged

Gerrrt merged 1 commit into
mainfrom
gerrrt/workflow-heartbeat

Conversation

@Gerrrt

@Gerrrt Gerrrt commented Nov 29, 2026

Copy link
Copy Markdown
Owner

What changed

A new daily job, workflow-state (scripts/collect-workflow-state.py, run on prometheus via run-scheduled.sh), asks GitHub's public API, anonymously, for each scheduled workflow's state and newest finished scheduled run, and writes github-workflows.prom. Three new warnings in backup.rules.yaml read it:

  • ScheduledWorkflowStale: no finished scheduled run in nine days.
  • ScheduledWorkflowDisabled: GitHub's 60-day inactivity disable, or a manual one.
  • AuditTokenExpiringSoon: 30 days before the weekly audit's one-year CLAUDE_CODE_OAUTH_TOKEN lapses.

New units systemd/homelab-workflow-state.{service,timer}, a JOBS row, make workflow-state, promtool tests, and a runbook section with the token-rotation steps. 190 Prometheus rules, 218 in all.

Why

cve-scan, digests, the weekly audit, wiki-watch and Scorecard run only on GitHub's schedule, and a stopped schedule sends nothing. The clock is the last finished run, not the last success: the first live read found digests had failed on each of the four Mondays since 2026-11-02, which it does on purpose when it finds drift. A last-success clock would fire on it for good.

The token's issue date is set to 2026-11-26, the day the audit was added (#1773). Confirm it against gh secret list.

Blast radius

prometheus gets one more daily timer making about ten anonymous HTTPS calls to api.github.com. Three new warnings, none paging. If the collector breaks, ScheduledJobStale covers it.

  • No change to network segmentation or firewall rules
  • No new port published to a VLAN that could not already reach the service
  • No credential added outside secrets/*.sops.yaml

Verification

  • scripts/collect-workflow-state.py --self-test: 15 PASS. This includes "every scheduled workflow in .github/workflows is declared".

  • --stdout against the live API printed all four existing workflows active. scorecard.yml is skipped until that PR merges.

  • promtool v3.16.0, the pinned version, checksum-verified: check rules backup.rules.yaml gave 10 rules; test rules workflow-state.test.yaml backup.test.yaml gave SUCCESS.

  • check_docs.py OK. lint.sh passed, with docker-backed linters skipped. self-tests.sh can't run cleanly on this Windows host (no python3 or openssl); CI runs it.

  • make validate passes (not run here; no docker)

  • Deployed to the lab and confirmed working (after merge: make install-timers on prometheus, then systemctl list-timers 'homelab-workflow-state*')

  • Docs updated (docs/, service README, or docs/roadmap.md)
    🤖 Generated with Claude Code

cve-scan, digests, the weekly audit, wiki-watch and Scorecard run only
on GitHub's schedule, and GitHub disables a public repository's
schedules after 60 days of inactivity without telling anyone. A daily
workflow-state job asks the public API for each workflow's state and
newest finished scheduled run, and carries the expiry of the audit's
one-year Claude OAuth token. ScheduledWorkflowStale,
ScheduledWorkflowDisabled and AuditTokenExpiringSoon read it, with
promtool tests for each.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Gerrrt
Gerrrt merged commit 22b3ed4 into main Nov 29, 2026
9 checks passed
@Gerrrt
Gerrrt deleted the gerrrt/workflow-heartbeat branch November 29, 2026 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant