This GitHub Action uses patchwork-cli to automatically generate documentation for a folder in your repository in form of a README.md file.
- Automatically generates documentation from your code
- Supports various LLM providers (OpenAI, local models, or custom endpoints)
- Creates pull requests with the generated documentation
- Configurable file filtering and comment handling
- Customizable output file name and branch naming
name: Generate Documentation
on:
workflow_dispatch: # Allow manual triggers
jobs:
generate-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: patched-codes/[email protected]
with:
patched_api_key: ${{ secrets.PATCHED_API_KEY }}
folder_path: "./src" # Path to the folder to generate documentation for
One of the following must be provided:
patched_api_key
: Patched API key for the LLM (Get an API key)openai_api_key
: OpenAI API key for the LLM (Get an API key)
folder_path
: Path to the folder to generate documentation for (default: './')github_token
: GitHub token for creating pull requests (default: Automatically set by GitHub)model
: LLM model to useclient_base_url
: Base URL for the LLM APIfilter
: Filter for the kind of files to include (e.g., '*.py' for Python files)suppress_comments
: Whether to suppress comments in the documentationmarkdown_file_name
: Name of the generated markdown filebranch_prefix
: Prefix for the created branch (default: 'patched-generate-readme/')disable_branch
: Disable creating new branchesdisable_pr
: Disable creating pull requestsforce_pr_creation
: Force push commits to existing PRmodel_temperature
: Temperature parameter for the LLMmodel_top_p
: Top-p parameter for the LLMmodel_max_tokens
: Maximum tokens for the LLM response
- uses: patched-codes/[email protected]
with:
patched_api_key: ${{ secrets.PATCHED_API_KEY }}
folder_path: "./src"
- uses: patched-codes/[email protected]
with:
patched_api_key: ${{ secrets.PATCHED_API_KEY }}
folder_path: "./src"
filter: "*.py"
suppress_comments: true
markdown_file_name: "API.md"
MIT
Contributions are welcome! Please feel free to submit a Pull Request.