feat: reusable review workflow
tests / unittest (push) Successful in 19s

Callers use Civilytics/docs-review/.gitea/workflows/review.yml@v1 with secrets: inherit.
Stage 1 on every pull request; for drafter: claude, a 180-second wait and then the sandboxed
drafter; closed pull requests close their docs PR; schedule and dispatch run the monthly
pass. Tested live against Gitea 28.3 (drafter none, a misspelled drafter, claude, close).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jaredandClaude Opus 5.5 committed 2026-11-12 15:12:57 -05:00
1 parent ade847ba5b
commit f39409e62c
11 files changed
+466 -26

No files matched your search

+4 -3
View File
@@ -64,13 +64,13 @@ def post_issue(forge, flags: tuple[Flag, ...], month: str, note: str | None = No
def _checkout(base: str, month: str, reuse: dict | None, ident, cwd: Path) -> str | None:
"""The branch to draft on, or None when a reused branch no longer merges."""
git.run(["fetch", "-q", "origin", base], cwd)
git.fetch(base, cwd)
if reuse is None:
branch = f"{MONTHLY_PREFIX}{month}"
git.checkout_new(branch, f"origin/{base}", cwd)
return branch
branch = reuse["head"]["ref"]
git.run(["fetch", "-q", "origin", branch], cwd)
git.fetch(branch, cwd)
git.checkout_new(branch, "FETCH_HEAD", cwd)
try:
git.merge(f"origin/{base}", ident, cwd)
@@ -92,7 +92,8 @@ def _commit_message(inputs: Inputs, month: str) -> str:
def _deliver(forge, inputs, base, month, branch, reuse, ident, flags, result, changed, cwd,
env):
git.commit(changed, _commit_message(inputs, month), ident, cwd)
git.push(branch, cwd, env.get("DOCS_REVIEW_BOT_TOKEN"))
git.push(branch, cwd, env.get("DOCS_REVIEW_BOT_TOKEN"),
env.get("GITHUB_SERVER_URL"))
head = git.run(["rev-parse", "HEAD"], cwd).strip()
body = render_pr_body(parse_summary(result.text), result, flags, head, changed)
title = f"docs: monthly review {month}"