ci: sync docs via Claude after merged PRs - #1311
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a workflow (
.github/workflows/claude-doc-sync.yml) that runs after a PR merges intomaster: it asks Claude to checkgh pr difffor 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 intomaster(notbetaor anything else), gated ongithub.event.pull_request.merged == true.gh pr view --json reviewDecisionand only lets the Claude step run when the decision isAPPROVED.masterrequires 1 approval via branch protection, butenforce_adminsis 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_targetrather thanpull_request: this repo takes external contributions (see #1297, #1310), and a plainpull_requesttrigger gets a read-onlyGITHUB_TOKENfor fork-authored PRs, which would make thegh pr createstep 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 outbase.ref(the already-reviewed, already-merged default branch) withactions/checkout— it never checks out, builds, or executes the contributor's own head ref/commit.Status:
ANTHROPIC_API_KEYsecret has been added (scoped to thetweek-segment-libsworkspace), 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