Skip to content

ci: sync docs via Claude after merged PRs - #1311

Merged
abueide merged 2 commits into
masterfrom
abueide/claude-doc-sync-workflow
Aug 25, 2026
Merged

ci: sync docs via Claude after merged PRs#1311
abueide merged 2 commits into
masterfrom
abueide/claude-doc-sync-workflow

Conversation

@abueide

@abueide abueide commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Adds a workflow (.github/workflows/claude-doc-sync.yml) that runs after a PR merges into master: it asks Claude to check gh pr diff for that PR against this repo's documentation (root README, package READMEs, /docs), and only if something is now out of date, opens a follow-up PR fixing it. If nothing needs updating, it's a no-op — no branch or PR gets created.

Trigger, gated to keep run volume/cost down:

  • pull_request_target: types: [closed], branches: [master] — only merges into master (not beta or anything else), gated on github.event.pull_request.merged == true.
  • A "Require an approved review" gate step calls gh pr view --json reviewDecision and only lets the Claude step run when the decision is APPROVED. master requires 1 approval via branch protection, but enforce_admins is off, so an admin can still merge without one — this closes that gap rather than assuming branch protection alone guarantees a review happened.

Deliberately pull_request_target rather than pull_request: this repo takes external contributions (see #1297, #1310), and a plain pull_request trigger gets a read-only GITHUB_TOKEN for fork-authored PRs, which would make the gh pr create step fail silently on exactly the PRs most likely to need a maintainer follow-up. This is safe to do here because the job only ever checks out base.ref (the already-reviewed, already-merged default branch) with actions/checkout — it never checks out, builds, or executes the contributor's own head ref/commit.

Status: ANTHROPIC_API_KEY secret has been added (scoped to the tweek-segment-libs workspace), and the Claude GitHub App is already installed on this repo — so this should be ready to go live once merged.

🤖 Generated with Claude Code

abueide and others added 2 commits August 25, 2026 15:00
Adds a workflow that runs after every merged PR and asks Claude to
check whether root/package READMEs or /docs need updating to reflect
the change, opening a follow-up PR only when it finds something to
update.

Uses pull_request_target rather than pull_request so the workflow gets
write access even for merges of fork-authored PRs (common in this
repo). This is safe because the job only ever checks out base.ref (the
already-merged, already-reviewed default branch) - it never builds or
executes the contributor's own head ref.

Requires an ANTHROPIC_API_KEY repo secret and the Claude GitHub App
(https://github.com/apps/claude) installed on this repo; neither is
included here.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Restricts the trigger to PRs merged into master (branches: [master]),
and adds a gate step that only lets the Claude step run when
gh pr view reports reviewDecision == APPROVED. master requires 1
approval via branch protection, but enforce_admins is off, so an admin
can still merge without one - this closes that gap instead of assuming
protection alone guarantees a review happened. Cuts run volume/cost by
skipping merges to other branches (e.g. beta) and admin-bypassed
merges with no approval on record.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@abueide
abueide merged commit 8b72319 into master Aug 25, 2026
11 checks passed
@abueide
abueide deleted the abueide/claude-doc-sync-workflow branch August 25, 2026 20:15
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