Skip to content

feat: blog auto-publish cron#33

Merged
avrabe merged 1 commit into
mainfrom
feat/blog-autopublish-cron
Apr 25, 2026
Merged

feat: blog auto-publish cron#33
avrabe merged 1 commit into
mainfrom
feat/blog-autopublish-cron

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented Apr 25, 2026

Summary

Daily 06:00 UTC GitHub Actions workflow that scans content/blog/ drafts and publishes those whose scheduled date has arrived. Pattern modelled on rivet-delta — bot-marker comment that updates in place, status report every run (not just on publish days).

The convention this enforces:

draft = true  AND  date <= today  AND  NOT hold   →  publish
draft = true  AND  date  > today                  →  wait (scheduled)
hold = true                                       →  never (parked)

What runs each day:

  1. Scan with scripts/blog-autopublish.py --mode scan → JSON inventory
  2. For each ready post: branch cron/publish-<slug>-<YYYY-MM-DD>, flip draft = false, commit, push, open auto-merge PR (label autopublish), squash-merge
  3. Render markdown report and upsert it on the pinned status issue (label autopublish-status) using <!-- blog-cron-status --> as the bot-marker
  4. On any step failing: auto-open an issue tagged autopublish-failure

Files:

  • .github/workflows/blog-autopublish.yml — the workflow
  • scripts/blog-autopublish.py — scanner / flip / report (~150 lines, regex-based frontmatter parser, no extra deps)

Sample report output

Tested locally simulating 2026-04-29 with the current draft inventory:

<!-- blog-cron-status -->
## Blog auto-publish · last run 2026-04-29

**This run:** published 1 —
- `overdoing-the-verification-chain` (PR #99)

**Scheduled (1):**
- 2026-04-30 · `variant-pruning-rust-mcdc` — MC/DC for AI-authored Rust is tractable …

**Held (1):**
- ∞ · `witness-wasm-mcdc` — witness — MC/DC for the WebAssembly component model

_Run: <link>_

Test plan

  • Script tested locally: scan correctly categorizes the 3 current drafts (2 scheduled, 1 held). Report renders with right counts + bot-marker.
  • YAML parses
  • CI passes on PR
  • After merge, fire workflow_dispatch manually to verify the no-op path works (no publishes today, status issue gets created with the inventory)
  • On 2026-04-29 06:00 UTC: cron fires automatically, overdoing-the-verification-chain publishes, deploy follows

Security note

Triggers are schedule and workflow_dispatch only — no pull_request_target or other event with untrusted user input. All values flowing into shell run: blocks come from server-controlled context vars or from the scanner reading our own repo's frontmatter. No command-injection surface from external actors.

🤖 Generated with Claude Code

Adds a daily 06:00 UTC GitHub Actions workflow that:

- Scans content/blog/ for draft posts and categorizes them as
  ready / scheduled / held based on the date + hold frontmatter
  fields. The scan rule is:
    draft = true AND date <= today AND NOT hold  →  ready
    draft = true AND date  > today                →  scheduled
    hold = true                                   →  held (parked)
- For each ready post: opens a per-post squash-merge PR labelled
  `autopublish` that flips draft to false. Each publish becomes its
  own commit on main and triggers the existing deploy workflow.
- Always posts a status report to a pinned issue (label
  `autopublish-status`) using a hidden bot-marker comment that gets
  replaced in place each run, mirroring the rivet-delta pattern.
- Opens a separate `autopublish-failure` issue if any step fails.

Includes a workflow_dispatch trigger so the first run on 2026-04-29
can be fired manually rather than waiting for the schedule.

The scanner script is regex-based (not full-TOML) and handles only
the four frontmatter fields the cron cares about — title, date,
draft, hold — to avoid a tomllib dependency on the runner.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@avrabe avrabe merged commit 6208962 into main Apr 25, 2026
1 check passed
@avrabe avrabe deleted the feat/blog-autopublish-cron branch April 25, 2026 17: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