Skip to content

patched-codes/GenerateDocstring

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Patched GenerateDocstring Action

This GitHub Action uses patchwork-cli to automatically document methods in your code by generating docstrings.

Features

  • Automatically generates docstrings for methods in your code
  • Supports various LLM providers (OpenAI, local models, or custom endpoints)
  • Creates pull requests with the generated docstrings
  • Option to rewrite existing docstrings
  • Configurable base path for code scanning
  • Customizable branch naming and PR behavior

Usage

name: Generate Docstrings
on:
  workflow_dispatch: # Allow manual triggers

jobs:
  generate-docstrings:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: patched-codes/[email protected]
        with:
          patched_api_key: ${{ secrets.PATCHED_API_KEY }}
          base_path: "./src" # Path to start generating docstrings from

Inputs

Required

One of the following must be provided:

Optional

  • base_path: Base path to start generating docstrings from (default: './')
  • github_token: GitHub token for creating pull requests (default: Automatically set by GitHub)
  • model: LLM model to use
  • client_base_url: Base URL for the LLM API
  • rewrite_existing: Whether to rewrite existing docstrings
  • branch_prefix: Prefix for the created branch (default: 'patched-generate-docstring/')
  • disable_branch: Disable creating new branches
  • disable_pr: Disable creating pull requests
  • force_pr_creation: Force push commits to existing PR
  • model_temperature: Temperature parameter for the LLM
  • model_top_p: Top-p parameter for the LLM
  • model_max_tokens: Maximum tokens for the LLM response

Examples

Basic Usage

- uses: patched-codes/[email protected]
  with:
    patched_api_key: ${{ secrets.PATCHED_API_KEY }}
    base_path: "./src"

Custom Documentation Settings

- uses: patched-codes/[email protected]
  with:
    patched_api_key: ${{ secrets.PATCHED_API_KEY }}
    base_path: "./src"
    rewrite_existing: true
    branch_prefix: "docs/auto-docstrings/"

Using Custom Model

- uses: patched-codes/[email protected]
  with:
    openai_api_key: ${{ secrets.OPENAI_API_KEY }}
    base_path: "./src"
    model: "gpt-4"
    model_temperature: 0.2
    model_top_p: 0.95
    model_max_tokens: 2000

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published