Skip to content

ci: add PR explainer workflow (cloud + --upsert)#6

Open
utsengar wants to merge 2 commits into
mainfrom
ci/pr-explainer-workflow
Open

ci: add PR explainer workflow (cloud + --upsert)#6
utsengar wants to merge 2 commits into
mainfrom
ci/pr-explainer-workflow

Conversation

@utsengar

Copy link
Copy Markdown
Owner

Summary

Dogfoods @htmlbin/cli on this repo's own PRs. On every push, a coding agent reads the diff and writes a self-contained HTML explainer to ./preview.html; the CLI publishes it via the cloud backend with --upsert --metadata repo=... --metadata pr=..., so the URL is stable for the PR's lifetime. A sticky comment carries the URL and updates in place on each push; the drop is deleted when the PR closes.

Combines the two existing example workflows:

  • examples/agent-preview-workflow.yml — agent-generated HTML
  • examples/cloud-upsert-workflow.yml — cloud backend + metadata-keyed upsert

Required secrets (one-time setup)

Before this workflow does anything useful, add two repo secrets:

  • HTMLBIN_TOKEN — run htmlbin login locally, then cat ~/.config/htmlbin/token and paste it
  • ANTHROPIC_API_KEY — for Claude Code, which writes the explainer HTML
gh secret set HTMLBIN_TOKEN     --body "$(cat ~/.config/htmlbin/token)"
gh secret set ANTHROPIC_API_KEY --body "sk-ant-..."

Behavior

  • opened / synchronize / reopened → publish job runs, sticky comment shows the explainer URL
  • closed → teardown job deletes the drop and updates the sticky comment
  • Forked-PR runs won't have the secrets and will fail at the explainer step (standard GitHub Actions behavior for pull_request)

Test plan

  • Add HTMLBIN_TOKEN and ANTHROPIC_API_KEY repo secrets
  • Merge this PR (the workflow can't fire on the PR that introduces it)
  • Open a follow-up PR; confirm sticky comment appears with a working URL
  • Push a second commit to that PR; confirm same URL, refreshed page
  • Close the PR; confirm drop is deleted and sticky comment updates

🤖 Generated with Claude Code

A coding agent generates an HTML explainer of the diff on each push;
`publish --upsert --metadata repo=...,pr=...` keeps the URL stable for
the PR's lifetime. A sticky comment carries the URL and updates in
place; the drop is deleted when the PR closes.

Requires repo secrets HTMLBIN_TOKEN and ANTHROPIC_API_KEY.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented May 24, 2026

Copy link
Copy Markdown

PR explainer: https://htmlbin.dev/p/r6w2pQhgT

Generated from the diff against main (12 KB). Updates on every push; deleted when this PR closes.

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