{"id":28610953,"url":"https://github.com/textcortex/claude-code-pr-autodoc-action","last_synced_at":"2025-06-11T23:08:14.365Z","repository":{"id":295235363,"uuid":"989552523","full_name":"textcortex/claude-code-pr-autodoc-action","owner":"textcortex","description":"A GitHub Actions Workflow that will let Claude Code auto-generate documentations for your PRs after getting merged","archived":false,"fork":false,"pushed_at":"2025-06-10T14:47:05.000Z","size":66,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-10T16:25:35.566Z","etag":null,"topics":["claude","claude-ai","claude-ai-bot","claude-code","github-actions"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/textcortex.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-24T10:32:09.000Z","updated_at":"2025-06-10T14:40:07.000Z","dependencies_parsed_at":"2025-05-24T11:47:38.127Z","dependency_job_id":null,"html_url":"https://github.com/textcortex/claude-code-pr-autodoc-action","commit_stats":null,"previous_names":["osolmaz/claude-code-pr-autodoc-action"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/textcortex/claude-code-pr-autodoc-action","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/textcortex%2Fclaude-code-pr-autodoc-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/textcortex%2Fclaude-code-pr-autodoc-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/textcortex%2Fclaude-code-pr-autodoc-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/textcortex%2Fclaude-code-pr-autodoc-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/textcortex","download_url":"https://codeload.github.com/textcortex/claude-code-pr-autodoc-action/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/textcortex%2Fclaude-code-pr-autodoc-action/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259361007,"owners_count":22845828,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["claude","claude-ai","claude-ai-bot","claude-code","github-actions"],"created_at":"2025-06-11T23:08:10.758Z","updated_at":"2025-06-11T23:08:14.358Z","avatar_url":"https://github.com/textcortex.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Claude Code PR Documentation Action\n\n[![GitHub Marketplace](https://img.shields.io/badge/Marketplace-Claude%20Code%20PR%20Documentation-blue?logo=github)](https://github.com/marketplace/actions/claude-code-pr-documentation)\n[![License](https://img.shields.io/github/license/textcortex/claude-code-pr-autodoc-action)](https://github.com/textcortex/claude-code-pr-autodoc-action/blob/main/LICENSE)\n\nAutomatically generate comprehensive documentation for your merged pull requests using [Claude Code](https://claude.ai/code). This GitHub Action helps maintain consistent and detailed documentation by analyzing PR changes and creating well-structured markdown files.\n\n## Features\n\n- 🤖 **AI-Powered Documentation**: Uses Claude Code to analyze code changes and generate meaningful documentation\n- ⚙️ **Highly Configurable**: Customize thresholds, prompts, and output directories\n- 🔄 **Automatic PR Creation**: Creates a new PR with the generated documentation\n- 📊 **Smart Filtering**: Only documents PRs that meet your criteria (lines/files changed)\n- 🏷️ **Customizable Tags**: Add custom tags to commits and PR titles\n- 🚀 **Easy Integration**: Works seamlessly with the Claude GitHub app\n- 🏃 **Runs on Your Infrastructure**: The action executes entirely on your own GitHub runner\n\n## Quickstart\n\nThe easiest way to set up this action is if you already have the Claude GitHub app installed. If you've already used Claude Code Action, this will work automatically!\n\n### Prerequisites\n\n1. Install the Claude GitHub app to your repository: https://github.com/apps/claude\n2. Add `ANTHROPIC_API_KEY` to your repository secrets ([Learn how to use secrets in GitHub Actions](https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions))\n\n### Basic Usage\n\n```yaml\nname: Auto-generate PR Documentation\n\non:\n  pull_request:\n    types: [closed]\n    branches:\n      - main\n\njobs:\n  generate-documentation:\n    # Only run when PR is merged and not created by bots\n    # This prevents infinite loops and saves compute resources\n    if: |\n      github.event.pull_request.merged == true \u0026\u0026\n      github.event.pull_request.user.type != 'Bot' \u0026\u0026\n      !startsWith(github.event.pull_request.title, 'docs: Add documentation for PR')\n    runs-on: ubuntu-latest\n    permissions:\n      contents: write\n      pull-requests: write\n      id-token: write  # Required for OIDC authentication\n\n    steps:\n      - uses: textcortex/claude-code-pr-autodoc-action@v1\n        with:\n          anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}\n```\n\n### Advanced Usage\n\n```yaml\nname: Auto-generate PR Documentation\n\non:\n  pull_request:\n    types: [closed]\n    branches:\n      - main\n      - develop\n\njobs:\n  generate-documentation:\n    # Only run for merged PRs that don't have the 'skip-docs' label\n    # The action itself will also check for bot-created PRs to prevent loops\n    if: |\n      github.event.pull_request.merged == true \u0026\u0026\n      !contains(github.event.pull_request.labels.*.name, 'skip-docs')\n    runs-on: ubuntu-latest\n    permissions:\n      contents: write\n      pull-requests: write\n      id-token: write  # Required for OIDC authentication\n\n    steps:\n      - uses: textcortex/claude-code-pr-autodoc-action@v1\n        with:\n          anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}\n          min_lines_changed: \"100\"\n          min_files_changed: \"3\"\n          documentation_directory: \"docs/pull-requests\"\n          commit_tags: \"[skip ci] [auto-doc]\"\n          pr_title_tags: \"[Documentation]\"\n          timeout_minutes: \"15\"\n          custom_instructions: |\n            Focus on:\n            - Business impact and user-facing changes\n            - Technical architecture decisions\n            - Performance implications\n            - Security considerations\n            - Testing coverage\n\n            Be concise but thorough.\n```\n\n## Inputs\n\n| Input                     | Description                                                                                                          | Required | Default                               |\n| ------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------- | ------------------------------------- |\n| `anthropic_api_key`       | Anthropic API key (required for direct API, not needed for Bedrock/Vertex)                                           | No\\*     | -                                     |\n| `min_lines_changed`       | Minimum lines changed to trigger documentation                                                                       | No       | `50`                                  |\n| `min_files_changed`       | Minimum files changed to trigger documentation                                                                       | No       | `1`                                   |\n| `documentation_prompt`    | Custom prompt for Claude                                                                                             | No       | See [default prompt](#default-prompt) |\n| `commit_tags`             | Tags to append to commit message                                                                                     | No       | `[skip ci]`                           |\n| `pr_title_tags`           | Tags to append to PR title                                                                                           | No       | `[skip ci]`                           |\n| `documentation_directory` | Directory for documentation files                                                                                    | No       | `docs/prs`                            |\n| `timeout_minutes`         | Timeout for Claude (minutes)                                                                                         | No       | `10`                                  |\n| `github_token`            | GitHub token for Claude to operate with. **Only include this if you're connecting a custom GitHub app of your own!** | No       | -                                     |\n| `model`                   | Model to use (provider-specific format required for Bedrock/Vertex)                                                  | No       | -                                     |\n| `use_bedrock`             | Use Amazon Bedrock with OIDC authentication instead of direct Anthropic API                                          | No       | `false`                               |\n| `use_vertex`              | Use Google Vertex AI with OIDC authentication instead of direct Anthropic API                                        | No       | `false`                               |\n| `allowed_tools`           | Additional tools for Claude to use (the base GitHub tools will always be included)                                   | No       | \"\"                                    |\n| `disallowed_tools`        | Tools that Claude should never use                                                                                   | No       | \"\"                                    |\n| `custom_instructions`     | Additional custom instructions to include in the prompt for Claude                                                   | No       | \"\"                                    |\n| `pr_labels`               | Comma-separated list of labels to apply to the PR (labels must already exist in the repository)                      | No       | \"\"                                    |\n\n\\*Required when using direct Anthropic API (default and when not using Bedrock or Vertex)\n\n### Default Prompt\n\nThe default prompt instructs Claude to:\n\n1. Analyze the PR changes using git commands\n2. Create a properly formatted markdown file with YAML frontmatter\n3. Document purpose, key modifications, technical details, impact, and any breaking changes\n4. Include related issues and follow-up tasks\n\n## Outputs\n\nThe action creates:\n\n- A markdown file in the specified directory with the format: `YYYY-MM-DD-descriptive-title.md`\n- A new PR containing the documentation\n- Proper git history linking back to the original PR\n\n## Example Documentation Output\n\n```markdown\n---\nauthor: Claude\ndate: 2024-01-15\ntitle: Implement Redis Caching for API Endpoints\npr_number: 142\npr_author: developer123\n---\n\n# Implement Redis Caching for API Endpoints\n\n## Purpose and Context\n\nThis PR introduces Redis caching to improve API response times and reduce database load...\n\n## Key Modifications\n\n1. **Added Redis client configuration** (`src/config/redis.js`)\n\n   - Configured connection pooling\n   - Implemented retry logic\n\n2. **Created caching middleware** (`src/middleware/cache.js`)\n   - TTL-based cache invalidation\n   - Cache key generation strategy\n\n[... continued ...]\n```\n\n## Cloud Providers\n\nYou can authenticate with Claude using any of these three methods:\n\n1. Direct Anthropic API (default)\n2. Amazon Bedrock with OIDC authentication\n3. Google Vertex AI with OIDC authentication\n\n### Using with AWS Bedrock\n\n```yaml\n# For AWS Bedrock with OIDC\n- name: Configure AWS Credentials (OIDC)\n  uses: aws-actions/configure-aws-credentials@v4\n  with:\n    role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}\n    aws-region: us-west-2\n\n- name: Generate GitHub App token\n  id: app-token\n  uses: actions/create-github-app-token@v2\n  with:\n    app-id: ${{ secrets.APP_ID }}\n    private-key: ${{ secrets.APP_PRIVATE_KEY }}\n\n- uses: textcortex/claude-code-pr-autodoc-action@v1\n  with:\n    model: \"anthropic.claude-3-7-sonnet-20250219-beta:0\"\n    use_bedrock: \"true\"\n    github_token: ${{ steps.app-token.outputs.token }}\n    # ... other inputs\n\npermissions:\n  id-token: write # Required for OIDC\n```\n\n### Using with Google Vertex AI\n\n```yaml\n# For GCP Vertex AI with OIDC\n- name: Authenticate to Google Cloud\n  uses: google-github-actions/auth@v2\n  with:\n    workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}\n    service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}\n\n- name: Generate GitHub App token\n  id: app-token\n  uses: actions/create-github-app-token@v2\n  with:\n    app-id: ${{ secrets.APP_ID }}\n    private-key: ${{ secrets.APP_PRIVATE_KEY }}\n\n- uses: textcortex/claude-code-pr-autodoc-action@v1\n  with:\n    model: \"claude-3-7-sonnet@20250219\"\n    use_vertex: \"true\"\n    github_token: ${{ steps.app-token.outputs.token }}\n    # ... other inputs\n\npermissions:\n  id-token: write # Required for OIDC\n```\n\n## Security\n\n### ⚠️ ANTHROPIC_API_KEY Protection\n\n**CRITICAL: Never hardcode your Anthropic API key in workflow files!**\n\nYour ANTHROPIC_API_KEY must always be stored in GitHub secrets:\n\n```yaml\n# CORRECT ✅\nanthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}\n\n# NEVER DO THIS ❌\nanthropic_api_key: \"sk-ant-api03-...\" # Exposed and vulnerable!\n```\n\n### GitHub App Permissions\n\nThe [Claude Code GitHub app](https://github.com/apps/claude) requires these permissions:\n\n- **Pull Requests**: Read and write to create PRs and push changes\n- **Issues**: Read and write to respond to issues\n- **Contents**: Read and write to modify repository files\n\n### Commit Signing\n\nAll commits made by Claude through this action are automatically signed with commit signatures.\n\n## Filtering and Exclusions\n\n### Important: Preventing Infinite Loops and Saving Compute\n\nTo prevent infinite documentation loops and save GitHub Actions compute resources, **always include proper `if` conditions in your workflow**:\n\n```yaml\nif: |\n  github.event.pull_request.merged == true \u0026\u0026\n  github.event.pull_request.user.type != 'Bot' \u0026\u0026\n  !startsWith(github.event.pull_request.title, 'docs: Add documentation for PR')\n```\n\nThis ensures:\n\n- No compute resources are wasted on PRs that won't be documented\n- No infinite loops where documentation PRs trigger more documentation\n- Clear filtering at the workflow level for better visibility\n\n### Built-in Filters\n\nThe action also includes internal checks for:\n\n- Unmerged PRs\n- PRs created by bots (including Claude Code itself)\n- PRs with titles starting with \"docs: Add documentation for PR\"\n- PRs with \"automated\" or \"documentation\" labels\n- PRs below the configured thresholds (lines/files changed)\n\nHowever, these internal checks run **after** the container starts, so workflow-level conditions are preferred for efficiency.\n\n## Troubleshooting\n\n### Documentation not generated\n\n1. Check if the PR meets the minimum thresholds\n2. Verify the Anthropic API key is correctly set\n3. Check the workflow logs for specific errors\n4. Ensure the Claude GitHub app is installed on your repository\n\n### Empty or incomplete documentation\n\n1. Increase the `timeout_minutes` value\n2. Simplify the `custom_instructions`\n3. Ensure the PR has meaningful changes to analyze\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n---\n\n🤖 Built with [Claude Code](https://claude.ai/code)\n\n## About\n\nThis action was developed by [TextCortex](https://github.com/textcortex) and is powered by [Claude Code](https://claude.ai/code) from Anthropic. While the underlying AI technology is provided by Anthropic, this specific GitHub Action implementation is maintained by TextCortex.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftextcortex%2Fclaude-code-pr-autodoc-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftextcortex%2Fclaude-code-pr-autodoc-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftextcortex%2Fclaude-code-pr-autodoc-action/lists"}