Skip to content

Instantly share code, notes, and snippets.

@davila7
Created September 16, 2025 17:35
Show Gist options
  • Select an option

  • Save davila7/6e63b457c1dc873ca4a9e4c74863f212 to your computer and use it in GitHub Desktop.

Select an option

Save davila7/6e63b457c1dc873ca4a9e4c74863f212 to your computer and use it in GitHub Desktop.
# .github/workflows/docusaurus-auto-docs.yml
name: Docusaurus Documentation Automation
on:
push:
branches:
# CUSTOMIZE: Add your default branch
- main
- master
- develop
paths:
# CUSTOMIZE: Add paths that should trigger documentation updates
- '**.js'
- '**.ts'
- '**.jsx'
- '**.tsx'
- '**.py'
- '**.java'
# CUSTOMIZE: Exclude paths
- '!.github/**'
- '!**/node_modules/**'
- '!**/dist/**'
- '!**/build/**'
jobs:
auto-document:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
# Ensure .claude directory exists
- name: Setup Claude configuration
run: |
mkdir -p .claude/agents
# Install agent if not exists
if [ ! -f ".claude/agents/docusaurus-expert.md" ]; then
npx claude-code-templates@latest \
--agent documentation/docusaurus-expert \
--yes \
--directory .
fi
# Get changed files for context
- name: Get changed files
id: changed
run: |
echo "files<<EOF" >> $GITHUB_OUTPUT
git diff --name-only HEAD^ HEAD >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
# Execute with agent
- name: Update documentation
uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
prompt: |
Read and follow the instructions in .claude/agents/docusaurus-expert.md
Changed files in this commit:
${{ steps.changed.outputs.files }}
Requirements:
# CUSTOMIZE: Add your specific documentation requirements
1. Find the Docusaurus documentation (check: docs/, docu/, documentation/, website/docs/)
2. Update documentation for any changed functionality
3. Add new documentation for new features
4. Update API references if function signatures changed
5. Ensure all code examples match the current implementation
# CUSTOMIZE: Add project-specific rules
Project-specific rules:
- Documentation language: English
- Code examples should include TypeScript types where applicable
- Follow existing documentation structure and style
# CUSTOMIZE: Adjust settings
claude_args: "--max-turns 8"
# Create PR with documentation updates
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "docs: update via docusaurus-expert agent"
title: "📚 Documentation Update"
body: |
Automated documentation update based on code changes.
**Changed files:**
```
${{ steps.changed.outputs.files }}
```
branch: docs/auto-${{ github.sha }}
# CUSTOMIZE: Set your team or specific reviewers
# team-reviewers: documentation-team
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment