{"id":51316981,"url":"https://github.com/tiennm99/claude-code-routine-trigger","last_synced_at":"2026-07-01T08:30:56.744Z","repository":{"id":353529529,"uuid":"1219800160","full_name":"tiennm99/claude-code-routine-trigger","owner":"tiennm99","description":"Scheduled GitHub Actions workflow that fires a Claude Code routine on a customizable cron (default 5x daily, UTC+7) via the /fire API. Fire URL and per-routine token from repo secrets; manual workflow_dispatch for on-demand runs.","archived":false,"fork":false,"pushed_at":"2026-05-08T16:53:09.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-08T18:42:19.757Z","etag":null,"topics":["ai-automation","anthropic","anthropic-api","api-trigger","automation","claude-ai","claude-code","claude-code-routines","cron","cron-scheduler","github-actions","github-actions-workflow","routine-trigger","scheduled-workflow","workflow-dispatch"],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tiennm99.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-24T08:24:54.000Z","updated_at":"2026-05-08T16:53:14.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/tiennm99/claude-code-routine-trigger","commit_stats":null,"previous_names":["tiennm99/claude-code-routine-trigger"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tiennm99/claude-code-routine-trigger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiennm99%2Fclaude-code-routine-trigger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiennm99%2Fclaude-code-routine-trigger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiennm99%2Fclaude-code-routine-trigger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiennm99%2Fclaude-code-routine-trigger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tiennm99","download_url":"https://codeload.github.com/tiennm99/claude-code-routine-trigger/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiennm99%2Fclaude-code-routine-trigger/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34999790,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-01T02:00:05.325Z","response_time":130,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-automation","anthropic","anthropic-api","api-trigger","automation","claude-ai","claude-code","claude-code-routines","cron","cron-scheduler","github-actions","github-actions-workflow","routine-trigger","scheduled-workflow","workflow-dispatch"],"created_at":"2026-07-01T08:30:54.985Z","updated_at":"2026-07-01T08:30:56.719Z","avatar_url":"https://github.com/tiennm99.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# claude-code-routine-trigger\n\n\u003e [!IMPORTANT]\n\u003e **No longer used by the author.** Claude Code routines now ship with a **built-in cron trigger** in the routine editor — that's what I use now. Prefer the native scheduler; it runs on Anthropic's infra (no GitHub Actions delay/drop issues), needs no repo, no secrets, no workflow file.\n\u003e\n\u003e This repo is kept as a reference for anyone who still wants to fire routines from an external scheduler (GitHub Actions, own cron, Cloud Scheduler, etc.).\n\u003e\n\u003e If you want **self-hosted scheduling with sub-second precision** (no GitHub cron delays/drops), see the sibling repo: [tiennm99/claude-code-routine-cron](https://github.com/tiennm99/claude-code-routine-cron) — Go daemon shipped as a multi-arch Docker image on GHCR.\n\n## Choose your deployment\n\n|                  | **claude-code-routine-trigger** (this) | [claude-code-routine-cron](https://github.com/tiennm99/claude-code-routine-cron) | [claude-code-routine-trigger-worker](https://github.com/tiennm99/claude-code-routine-trigger-worker) |\n| ---------------- | -------------------------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |\n| Runs on          | GitHub Actions runners                 | your infra (Docker, k8s, NAS, RPi)                                               | Cloudflare edge                                                                                      |\n| Cost             | free (within GitHub minutes)           | minimal (your infra)                                                             | free (CF free tier)                                                                                  |\n| Cron precision   | ±30 min – 2 h, can drop runs           | sub-second                                                                       | within ~15 sec                                                                                       |\n| Setup            | fork + 2 repo secrets                  | env vars + Docker                                                                | `wrangler deploy` + 2 secrets                                                                        |\n| Audit trail      | GitHub Actions runs page               | container stdout                                                                 | CF dashboard / `wrangler tail`                                                                       |\n\nPick **this repo** if you want zero-infra and don't care about precise firing time. Pick **-cron** for behind-firewall / on-prem / precise timing. Pick **-worker** for edge-native deploys with CF dashboard observability.\n\nScheduled GitHub Actions workflow that fires a [Claude Code routine](https://code.claude.com/docs/en/routines) via the [`/fire` API](https://platform.claude.com/docs/en/api/claude-code/routines-fire). Ships with a 5×-daily default cron and exposes a `workflow_dispatch` button for on-demand runs. Fire URL and per-routine token live in repo secrets.\n\n**Why:** GitHub cron is the cheapest way to run a Claude Code routine unattended on a schedule — no servers, no extra scheduler, no billable infra.\n\nDefault schedule (UTC+7, `Asia/Ho_Chi_Minh`):\n\n| Local time | UTC cron      |\n| ---------- | ------------- |\n| 00:00      | `0 17 * * *`  |\n| 05:00      | `0 22 * * *`  |\n| 10:00      | `0 3 * * *`   |\n| 15:00      | `0 8 * * *`   |\n| 20:00      | `0 13 * * *`  |\n\nManual `workflow_dispatch` is supported with an optional `text` input for ad-hoc runs. Customize the cron list to match your own cadence — see below.\n\n## Customize the schedule\n\nGitHub Actions requires the cron list to be **literal** in the workflow file — it cannot be read from secrets, repo variables, or inputs. To change when the routine fires, edit `.github/workflows/trigger-routine.yml` and update the `on.schedule` block:\n\n```yaml\non:\n  schedule:\n    - cron: '0 17 * * *' # 00:00 UTC+7\n    # add / remove / edit these lines as needed\n```\n\nTips:\n- Cron runs in **UTC**. Convert your local time: `UTC = local − offset` (e.g. 09:00 UTC+7 → 02:00 UTC → `0 2 * * *`).\n- Validate expressions at \u003chttps://crontab.guru/\u003e.\n- Schedules only activate on the default branch after the file is pushed.\n- **Avoid minute `0`.** Pick scattered minutes like `7`, `13`, `23`, `37`, `47` — see the warning below.\n\n\u003e [!WARNING]\n\u003e **GitHub cron delays can be severe at minute `0`.** Top-of-the-hour is the most contested slot on GitHub's shared runners — scheduled jobs there are commonly delayed by 30 min – 2+ hours, and during high load GitHub may **drop the run entirely** (see [Actions docs](https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#schedule)).\n\u003e\n\u003e Observed in this repo: a `0 13 * * *` cron fired at **14:46 UTC — 1h46m late** ([run 24895643143](https://github.com/tiennm99/claude-code-routine-trigger/actions/runs/24895643143)).\n\u003e\n\u003e The default schedule above still uses minute `0` for readability. If you care about timing, rewrite them — e.g. `7 17 * * *`, `13 22 * * *`, `19 3 * * *`, `23 8 * * *`, `37 13 * * *`. Do **not** rely on GitHub cron for precise timing; if you need it, trigger `/fire` from a real scheduler (own cron, Cloud Scheduler, etc.).\n\n## Setup\n\n1. Create a routine at \u003chttps://claude.ai/code/routines\u003e (requires a Pro/Max/Team/Enterprise plan with Claude Code on the web enabled).\n2. In the routine editor, add an **API** trigger and generate a token. Copy both the fire URL and the token — the token is shown once.\n3. Add two repository secrets (`Settings → Secrets and variables → Actions`):\n   - `ROUTINE_FIRE_URL` — e.g. `https://api.anthropic.com/v1/claude_code/routines/trig_01ABo4hmfydBLFDgRMnKwEKy/fire`\n   - `ROUTINE_FIRE_TOKEN` — e.g. `sk-ant-oat01-...`\n4. Enable Actions for the repo. Scheduled runs start on the next matching UTC tick.\n\n## Manual run\n\n`Actions → Trigger Claude Code Routine → Run workflow`. Leave `text` blank to get a timestamped default, or pass custom context (alert body, log line, etc.).\n\n## Request shape\n\n```bash\ncurl -X POST \"$ROUTINE_FIRE_URL\" \\\n  -H \"Authorization: Bearer $ROUTINE_FIRE_TOKEN\" \\\n  -H \"anthropic-version: 2023-06-01\" \\\n  -H \"anthropic-beta: experimental-cc-routine-2026-04-01\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"text\": \"Scheduled trigger ...\"}'\n```\n\nBeta header pinned to `experimental-cc-routine-2026-04-01`. Two previous dated beta versions keep working while migrating — bump when Anthropic ships a new one.\n\n## Notes\n\n- GitHub cron is best-effort: delays of 30+ minutes are common at minute `0`, and runs can be silently skipped under load. Acceptable for housekeeping-style routines, not for precise timing — see the warning in *Customize the schedule*.\n- Token is scoped to a single routine; a leak can only fire that one routine.\n- Each POST creates a new session (no idempotency). Avoid retry loops that would multiply sessions.\n- 429 responses include `Retry-After`; the workflow fails loud rather than retrying silently.\n\n## Use cases\n\nAnything a Claude Code routine already does, on a clock:\n- Daily repo triage (stale issues, dependabot PRs, unreviewed drafts).\n- Morning / evening digests written to a file in the routine's attached repo.\n- Scheduled codebase audits (unused exports, TODO sweep, lint drift).\n- Periodic doc freshness checks.\n\nFor event-driven triggers (CI failure, webhook, alert) call `/fire` from the producing system directly — a cron scheduler isn't the right shape.\n\n## License\n\nApache-2.0 — see [LICENSE](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiennm99%2Fclaude-code-routine-trigger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftiennm99%2Fclaude-code-routine-trigger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiennm99%2Fclaude-code-routine-trigger/lists"}