Skip to main content
This cookbook demonstrates how to use Droid Exec in GitHub Actions to automatically update documentation when code is merged to main. The workflow analyzes code changes, discovers relevant documentation, updates it, and creates a pull request for human review.

How it works

End-to-end automated workflow:
  1. Trigger: Code merged to main branch
  2. Explore: Droid exec explores codebase structure (project type, tech stack)
  3. Analyze: Identifies changed files and their purpose
  4. Discover: Searches docs/ directory for relevant documentation
  5. Update: Updates affected documentation sections
  6. Commit: Workflow creates commit
  7. PR: Bot opens pull request for team review

Prerequisites

To get started, you’ll need:
  • Droid installed
  • A Factory API key
  • GitHub repository with Actions enabled
  • FACTORY_API_KEY in repository secrets (Settings → Secrets → Actions)
  • Existing documentation directory
See the Droid Exec setup here.

Complete GitHub Actions workflow

This workflow will create pull requests automatically. Review the generated PRs carefully before merging to ensure accuracy.
Create .github/workflows/update-docs.yml:
Key workflow features:
  • Uses --auto low for file modifications only (following cookbook patterns)
  • Explicit instruction: “DO NOT commit or push” (separation of concerns)
  • Workflow handles git operations in separate step
  • Droid autonomously explores codebase and discovers relevant docs (no mapping file needed)

Best practices

1

Scope triggers carefully

Only trigger on meaningful code changes:
2

Use --auto low for safety

Following cookbook patterns:
3

Trust autonomous discovery

Let droid explore and find relevant docs rather than maintaining manual mappings:
4

Always generate summaries

Help reviewers understand changes:
5

Consider rate limits

For high-frequency repos, use scheduled batch updates:

Variations

Weekly comprehensive review

For repositories with frequent changes, batch updates into a weekly review:

Multiple documentation directories

If your docs are spread across multiple locations:

Language-specific targeting

Focus on specific file types:

Troubleshooting

Droid may have determined no docs needed updates. Check the workflow logs or add more specific search instructions in the prompt. You can also check if doc-update-summary.md was created to see what droid analyzed.
Improve the exploration prompt to be more specific about what to look for. Consider adding explicit instructions about which doc sections should or shouldn’t be modified.
Make the search instructions more explicit by pointing Droid Exec at specific directories, filenames, or keywords. Providing a short list of likely docs can dramatically improve accuracy.
For large repositories, consider:
  • Increasing the timeout in the workflow
  • Processing documentation updates in batches
  • Using scheduled updates instead of triggering on every merge

See also