ci(docs): add weekly docs update workflow#1365
Conversation
Adds a GitHub Actions workflow that runs weekly (Wednesdays) to review merged PRs and update documentation when features change.
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughAdds a new documentation-update prompt and a weekly GitHub Actions workflow to run Claude Code that scans merged PRs, applies targeted edits to MDX docs, and opens PRs when changes are detected; also tweaks branch naming and reviewer behavior in an existing changelog workflow. Changes
Sequence DiagramsequenceDiagram
participant Scheduler as GitHub Scheduler
participant Runner as Actions Runner
participant Repo as Repository
participant Claude as Claude Code
participant GHAPI as GitHub API
Scheduler->>Runner: Trigger workflow (weekly / manual)
Runner->>Repo: Checkout repository
Runner->>Runner: Setup Bun & install deps
Runner->>Runner: Install Claude Code
Runner->>Runner: Create dated branch
Runner->>Claude: Run prompt (`.github/prompts/update-docs.md`)
Claude->>Repo: Read recent merged PRs and docs (MDX)
Claude->>Repo: Apply targeted doc edits or add pages
Runner->>Repo: Detect changes
alt Changes detected
Runner->>Runner: Run lint fix
Runner->>Repo: Commit & push to branch
Runner->>GHAPI: Create Pull Request (with reviewers & checklist)
else No changes
Runner->>Scheduler: Complete without PR
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @.github/workflows/update-docs.yml:
- Around line 40-44: The branch creation step uses BRANCH_NAME and runs git
checkout -b which will fail on same-day re-runs if the branch already exists;
change the logic to make BRANCH_NAME include a unique suffix (e.g., append
GITHUB_RUN_ID or timestamp) or replace git checkout -b with git checkout -B
"$BRANCH_NAME" (or both) so the branch is unique or force-resettable; update the
BRANCH_NAME assignment and the git checkout invocation accordingly to prevent
collisions.
🧹 Nitpick comments (4)
.github/prompts/update-docs.md (1)
11-13: Reading every doc page upfront may be unnecessarily expensive.Line 13 instructs Claude to "read each existing doc page" before determining which PRs affect docs. Consider reading
meta.jsonfirst (already step 2a), then only reading individual pages once a PR is matched to them via the mapping table. This reduces token usage and keeps Claude focused..github/workflows/update-docs.yml (3)
66-73:git add -Astages everything — consider scoping to docs only.If Claude Code or the lint step inadvertently modifies files outside
apps/docs/(or creates temp files),git add -Awill include them in the commit. Scoping the add to the intended directories reduces the blast radius.Proposed fix
- git add -A + git add apps/docs/If
meta.jsonor other config files outsideapps/docs/may also be legitimately updated, add those paths explicitly.
18-21:fetch-depth: 0(full clone) is likely unnecessary.The workflow doesn't use git history — it creates a new branch, makes changes, and pushes. A shallow clone (default
fetch-depth: 1) would be faster. Thegh pr listcommand queries the API, not local git history.Proposed fix
- name: Check out code uses: actions/checkout@v4 - with: - fetch-depth: 0
37-38: Pin@anthropic-ai/claude-codeto a specific version.Installing without a version tag means the workflow silently picks up whatever
latestis at run time. A breaking change in a new Claude Code release could break the workflow without any change on your side.Proposed fix
- name: Install Claude Code - run: npm install -g `@anthropic-ai/claude-code` + run: npm install -g `@anthropic-ai/claude-code`@2.1.37Replace
2.1.37with whatever the current version is.
🚀 Preview Deployment🔗 Preview Links
Preview updates automatically with new commits |
Summary
generate-changelog.ymlpattern but targetsapps/docs/instead of the marketing changelogChanges
.github/workflows/update-docs.yml— New workflow that runs every Wednesday at 9:00 AM UTC (or manually). Checks out the repo, runs Claude Code with the prompt, lints, commits, and opens a PR if docs were updated..github/prompts/update-docs.md— Prompt that instructs Claude to fetch recent merged PRs, cross-reference them against a mapping table of doc pages (e.g., terminal changes →terminal-integration.mdx), make targeted edits, and skip if nothing needs updating.Test Plan
workflow_dispatchto verify end-to-endSummary by CodeRabbit