Skip to content

docs: agentic docs-update workflow#35

Merged
AaronForinton merged 10 commits intomainfrom
claude/hungry-wilson
Mar 24, 2026
Merged

docs: agentic docs-update workflow#35
AaronForinton merged 10 commits intomainfrom
claude/hungry-wilson

Conversation

@AaronForinton
Copy link
Copy Markdown
Contributor

@AaronForinton AaronForinton commented Mar 21, 2026

Summary

Adds a GitHub Actions workflow that automatically keeps the docs in sync with the codebase. Every time a PR is merged to main that touches `src/`, the workflow diffs what changed, sends the diff and all current docs to Claude, and opens a new PR with any suggested updates for human review before they are merged.

Motivation

The docs are fully hand-maintained today. Any new CLI flag, changed command behaviour, new resource type, or schema change requires a manual docs PR — and that update often doesn't happen. This automates the detection and drafting of those updates.

Changes

  • `.github/workflows/auto-update-docs.yaml` — triggers on push to main when `src/` changes, runs the agent script, opens a docs PR if anything was updated
  • `docs/scripts/update_docs.py` — gets the git diff, reads all current markdown files (reference pages first), calls Claude with both, and writes back any files Claude says need updating. PR body written to `/tmp/pr_summary.md` for the workflow to use

Test strategy

  • N/A (docs, config, or trivial change)

The `build-docs.yaml` workflow runs `mkdocs build --strict` on every PR — that is the validation gate for the docs side. The agent workflow is triggered by source code merges, not this PR, so it will not self-test. To test manually: merge a code PR touching `src/` and check the Actions tab for the `Auto-update docs` run.

Checklist

Setup required

One secret must be added before the workflow will do anything:

Settings → Secrets and variables → Actions → New repository secret

Name Value
`ANTHROPIC_API_KEY` Anthropic API key (personal or shared team key)

`GITHUB_TOKEN` (used to open the docs PR) is provided automatically by GitHub — no setup needed.

How it works

  1. Engineer merges a PR that changes `src/`
  2. `auto-update-docs` workflow fires and diffs `HEAD~1..HEAD`
  3. Claude reads the diff and all 32 docs pages (reference pages first), identifies anything stale
  4. Script writes updated files to disk; PR body written to `/tmp/pr_summary.md`
  5. Workflow opens a PR: `docs: auto-update from `
  6. Engineer reviews, edits if needed, and merges

AaronForinton and others added 4 commits March 13, 2026 17:27
# Conflicts:
#	src/poly/docs/docs/tutorials/build-an-agent.md
- Add mkdocs-gen-files script that auto-generates reference/cli-options.md
  from poly --help output at build time
- Add mkdocs-macros hook exposing {{ adk_version }} in all doc pages
- Update mkdocs.yml to register gen-files and macros plugins, add
  CLI options and Changelog nav entries
- Upgrade docs workflows to Python 3.14 and install poly before building
  so the gen script can call poly --help
- Add changelog copy step so CHANGELOG.md is included in the site
- Broaden publish-docs trigger to rebuild when src/, CHANGELOG.md,
  or pyproject.toml change

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a GitHub Actions workflow that runs on every merge to main (when
src/ or pyproject.toml changes). It diffs the merged code against the
previous commit, sends the diff and all current docs to Claude, and
applies any suggested updates. If Claude changes any files, the workflow
opens a PR for human review before the changes are merged.

New files:
- .github/workflows/auto-update-docs.yaml — the workflow
- docs/scripts/update_docs.py — the agent script

Requires ANTHROPIC_API_KEY to be set as a repository secret.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@AaronForinton AaronForinton changed the title Add docs automation: CLI gen, macros, and workflow updates docs: CLI gen, macros, and workflow updates Mar 21, 2026
@AaronForinton AaronForinton changed the title docs: CLI gen, macros, and workflow updates docs: CLI docs gen workflow updates Mar 21, 2026
AaronForinton and others added 4 commits March 21, 2026 21:13
- Resolve symlinks before path safety check to block traversal attacks
- Add existing-file guard so Claude cannot create new files
- Fix truncation message showing wrong character limit
- Increase max_tokens 8096 -> 16384 for multi-file rewrites
- Wrap API call in try/except to avoid failing CI on rate-limit errors
- Fix no_updates_needed exit inside loop (set flag, break, check after)
- Log stderr from failed subprocess calls instead of silently dropping
- Move PR summary to /tmp so it is not staged by git add docs/
- Switch to --body-file in gh pr create to avoid shell injection risk
- Drop pyproject.toml from trigger paths (version-only bumps are noise)
- Downgrade workflow Python from 3.14 to 3.11 (anthropic needs only 3.8+)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@AaronForinton AaronForinton changed the title docs: CLI docs gen workflow updates docs: agentic docs-update workflow Mar 21, 2026
Copy link
Copy Markdown
Contributor

@bplevin36 bplevin36 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will be interesting to see how well this works!

@AaronForinton
Copy link
Copy Markdown
Contributor Author

@bplevin36 I think we'll have to put a company Claude API key in the Repo secrets before it does anything, I'm not on the company Claude yet though!

@AaronForinton AaronForinton merged commit b330cc6 into main Mar 24, 2026
3 checks passed
@AaronForinton AaronForinton deleted the claude/hungry-wilson branch March 24, 2026 15:21
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.

2 participants