Skip to content

An AI-powered task-management system you can drop into Cursor, Lovable, Windsurf, Roo, and others.

feat: add Claude documentation updater workflow (#1130)

Ralph Khreishf469515228ca
diff --git a/.github/workflows/claude-docs-updater.yml b/.github/workflows/claude-docs-updater.yml
new file mode 100644
index 00000000..30f7a950
--- /dev/null
+++ b/.github/workflows/claude-docs-updater.yml
@@ -0,0 +1,154 @@
+name: Claude Documentation Updater
+
+on:
+ push:
+ branches:
+ - next
+ paths-ignore:
+ - 'apps/docs/**'
+ - '*.md'
+ - '.github/workflows/**'
+
+jobs:
+ update-docs:
+ # Only run if changes were merged (not direct pushes from bots)
+ if: github.event.pusher.name != 'github-actions[bot]' && github.event.pusher.name != 'dependabot[bot]'
+ runs-on: ubuntu-latest
+ permissions:
+ contents: write
+ pull-requests: write
+ issues: write
+ id-token: write
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 2 # Need previous commit for comparison
+
+ - name: Get changed files
+ id: changed-files
+ run: |
+ echo "Changed files in this push:"
+ git diff --name-only HEAD^ HEAD | tee changed_files.txt
+
+ # Store changed files for Claude to analyze
+ echo "changed_files<<EOF" >> $GITHUB_OUTPUT
+ git diff --name-only HEAD^ HEAD >> $GITHUB_OUTPUT
+ echo "EOF" >> $GITHUB_OUTPUT
+
+ # Get the commit message and changes summary
+ echo "commit_message<<EOF" >> $GITHUB_OUTPUT
+ git log -1 --pretty=%B >> $GITHUB_OUTPUT
+ echo "EOF" >> $GITHUB_OUTPUT
+
+ # Get diff for documentation context
+ echo "commit_diff<<EOF" >> $GITHUB_OUTPUT
+ git diff HEAD^ HEAD --stat >> $GITHUB_OUTPUT
+ echo "EOF" >> $GITHUB_OUTPUT
+
+ - name: Create docs update branch
+ id: create-branch
+ run: |
+ BRANCH_NAME="docs/auto-update-$(date +%Y%m%d-%H%M%S)"
+ git checkout -b $BRANCH_NAME
+ echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT
+
+ - name: Run Claude Code to Update Documentation
+ uses: anthropics/claude-code-action@beta
+ with:
+ anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
+ timeout_minutes: "30"
+ mode: "auto"
+ experimental_allowed_domains: |
+ .anthropic.com
+ .github.com
+ api.github.com
+ .githubusercontent.com
+ registry.npmjs.org
+ prompt: |
+ You are a documentation specialist. Analyze the recent changes pushed to the 'next' branch and update the documentation accordingly.
+
+ Recent changes:
+ - Commit: ${{ steps.changed-files.outputs.commit_message }}
+ - Changed files:
+ ${{ steps.changed-files.outputs.changed_files }}
+
+ - Changes summary:
+ ${{ steps.changed-files.outputs.commit_diff }}
+
+ Your task:
+ 1. Analyze the changes to understand what functionality was added, modified, or removed
+ 2. Check if these changes require documentation updates in apps/docs/
+ 3. If documentation updates are needed:
+ - Update relevant documentation files in apps/docs/
+ - Ensure examples are updated if APIs changed
+ - Update any configuration documentation if config options changed
+ - Add new documentation pages if new features were added
+ - Update the changelog or release notes if applicable
+ 4. If no documentation updates are needed, skip creating changes
+
+ Guidelines:
+ - Focus only on user-facing changes that need documentation
+ - Keep documentation clear, concise, and helpful
+ - Include code examples where appropriate
+ - Maintain consistent documentation style with existing docs
+ - Don't document internal implementation details unless they affect users
+ - Update navigation/menu files if new pages are added
+
+ Only make changes if the documentation truly needs updating based on the code changes.
+
+ - name: Check if changes were made
+ id: check-changes
+ run: |
+ if git diff --quiet; then
+ echo "has_changes=false" >> $GITHUB_OUTPUT
+ else
+ echo "has_changes=true" >> $GITHUB_OUTPUT
+ git add -A
+ git config --local user.email "github-actions[bot]@users.noreply.github.com"
+ git config --local user.name "github-actions[bot]"
+ git commit -m "docs: auto-update documentation based on changes in next branch
+
+ This PR was automatically generated to update documentation based on recent changes.
+
+ Original commit: ${{ steps.changed-files.outputs.commit_message }}
+
+ Co-authored-by: Claude <[email protected]>"
+ fi
+
+ - name: Push changes and create PR
+ if: steps.check-changes.outputs.has_changes == 'true'
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ run: |
+ git push origin ${{ steps.create-branch.outputs.branch_name }}
+
+ # Create PR using GitHub CLI
+ gh pr create \
+ --title "docs: update documentation for recent changes" \
+ --body "## 📚 Documentation Update
+
+ This PR automatically updates documentation based on recent changes merged to the \`next\` branch.
+
+ ### Original Changes
+ **Commit:** ${{ github.sha }}
+ **Message:** ${{ steps.changed-files.outputs.commit_message }}
+
+ ### Changed Files in Original Commit
+ \`\`\`
+ ${{ steps.changed-files.outputs.changed_files }}
+ \`\`\`
+
+ ### Documentation Updates
+ This PR includes documentation updates to reflect the changes above. Please review to ensure:
+ - [ ] Documentation accurately reflects the changes
+ - [ ] Examples are correct and working
+ - [ ] No important details are missing
+ - [ ] Style is consistent with existing documentation
+
+ ---
+ *This PR was automatically generated by Claude Code GitHub Action*" \
+ --base next \
+ --head ${{ steps.create-branch.outputs.branch_name }} \
+ --label "documentation" \
+ --label "automated"
\ No newline at end of file