* feat: add formatted output for Claude Code execution reports
- Write turns formatter
- Modify GitHub Action to call formatter instead of dumping raw JSON
- Add comprehensive unit tests (30 tests) covering all functionality
- Add integration test with sample data for output consistency
- Support syntax highlighting for multiple content types (JSON, Python, bash, etc.)
- Include turn grouping logic and token usage tracking
- Provide CLI interface for standalone formatter usage
🤖 Generated with [Claude Code](https://claude.ai/code)
Note: seriously I have never written any line of ts code in my life, so
please make sure this is fine as I don't give any guarantees
Co-Authored-By: Claude <noreply@anthropic.com>
* Add fallback
---------
Co-authored-by: Claude <noreply@anthropic.com>
* fixed file ingestion
* working binary files
* added replaced baseUrl
* fix: add type assertion for GitHub blob API response
Fixes TypeScript error where blobData was of type 'unknown' by adding
proper type assertion for the blob creation response.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Andrew Grosser <dioptre@gmail.com>
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Andrew Grosser <dioptre@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
- introduced a new input parameter `label_trigger` in `action.yml` to allow triggering actions based on specific labels applied to issues.
- Enhanced the context preparation and event handling in the code to support the new labled event.
- Modified validation logic to only require assignee_trigger when direct_prompt is not provided
- Made assigneeTrigger optional in IssueAssignedEvent type definition
- Enhanced context generation to handle missing assigneeTrigger gracefully
- Added comprehensive test coverage for the new behavior
This enables direct_prompt workflows on issue assignment events without
requiring assignee_trigger configuration, fixing the error:
"ASSIGNEE_TRIGGER is required for issue assigned event"
Fixes#113🤖 Generated with [Claude Code](https://claude.ai/code)
Co-authored-by: Claude <noreply@anthropic.com>
* fix: use direct assignee field
* fix: correct assignee trigger test to handle different assignee properly
The test was failing because the mockIssueAssignedContext was missing the
top-level assignee field that the trigger validation logic checks. Added
the missing assignee field to the mock context and updated the test to
properly override both the top-level assignee and issue.assignee fields
when testing assignment to a different user.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Adjust IssuesAssignedEvent import position (#2)
---------
Co-authored-by: Claude <noreply@anthropic.com>
* feat: enhance error reporting with specific error types from Claude execution
- Extract error subtypes (error_during_execution, error_max_turns) from result object
- Display specific error messages in comment header based on error type
- Use total_cost_usd field from SDKResultMessage type
- Prevent showing redundant error details when already displayed in header
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* chore: update claude-code-base-action to v0.0.19
* feat: use GitHub display name in Co-authored-by trailers (#163)
* feat: use GitHub display name in Co-authored-by trailers
- Add name field to GitHubAuthor type
- Update GraphQL queries to fetch user display names
- Add triggerDisplayName to CommonFields type
- Extract display name from fetched GitHub data in prepareContext
- Update Co-authored-by trailer generation to use display name when available
This ensures consistency with GitHub's web interface behavior where
Co-authored-by trailers use the user's display name rather than username.
Co-authored-by: ashwin-ant <ashwin-ant@users.noreply.github.com>
* fix: update GraphQL queries to handle Actor type correctly
The name field is only available on the User subtype of Actor in GitHub's
GraphQL API. This commit updates the queries to use inline fragments
(... on User) to conditionally access the name field when the actor is
a User type.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* refactor: clarify Co-authored-by instructions in prompt
Replace interpolated values with clear references to XML tags and add
explicit formatting instructions. This makes it clearer how to use the
GitHub display name when available while maintaining the username for
the email portion.
Changes:
- Use explicit references to <trigger_display_name> and <trigger_username> tags
- Add clear formatting instructions and example
- Explain fallback behavior when display name is not available
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* feat: fetch trigger user display name via dedicated GraphQL query
Instead of trying to extract the display name from existing data (which
was incomplete due to Actor type limitations), we now:
- Add a dedicated USER_QUERY to fetch user display names
- Pass the trigger username to fetchGitHubData
- Fetch the display name during data collection phase
- Simplify prepareContext to use the pre-fetched display name
This ensures we always get the correct display name for Co-authored-by
trailers, regardless of where the trigger came from.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: ashwin-ant <ashwin-ant@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
* feat: use dynamic fetch depth based on PR commit count (#169)
- Replace fixed depth of 20 with dynamic calculation
- Use Math.max(commitCount, 20) to ensure minimum context
* Accept multiline input for allowed_tools and disallowed_tools (#168)
* docs: add uv example for Python MCP servers in mcp_config section (#170)
Added documentation showing how to configure Python-based MCP servers using uv
with the --directory argument, as requested in issue #130.
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: Ashwin Bhat <ashwin-ant@users.noreply.github.com>
* feat: add release workflow with beta tag management (#171)
- Auto-increment patch version for new releases
- Update beta tag to point to latest release
- Update major version tag (v0) for simplified action usage
- Support dry run mode for testing
- Keep beta as the "latest" release channel
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-authored-by: Claude <noreply@anthropic.com>
* chore: update claude-code-base-action to v0.0.20
* update MCP server image to version 0.5.0 (#175)
* refactor: convert error subtype check to switch case
Replace if-else chain with switch statement for better readability
and maintainability when handling error subtypes.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: GitHub Actions <actions@github.com>
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: ashwin-ant <ashwin-ant@users.noreply.github.com>
Co-authored-by: Bastian Gutschke <bge@medicuja.com>
Co-authored-by: Hidetake Iwata <int128@gmail.com>
Co-authored-by: Tomohiro Ishibashi <103555868+tomoish@users.noreply.github.com>
* feat: use GitHub display name in Co-authored-by trailers
- Add name field to GitHubAuthor type
- Update GraphQL queries to fetch user display names
- Add triggerDisplayName to CommonFields type
- Extract display name from fetched GitHub data in prepareContext
- Update Co-authored-by trailer generation to use display name when available
This ensures consistency with GitHub's web interface behavior where
Co-authored-by trailers use the user's display name rather than username.
Co-authored-by: ashwin-ant <ashwin-ant@users.noreply.github.com>
* fix: update GraphQL queries to handle Actor type correctly
The name field is only available on the User subtype of Actor in GitHub's
GraphQL API. This commit updates the queries to use inline fragments
(... on User) to conditionally access the name field when the actor is
a User type.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* refactor: clarify Co-authored-by instructions in prompt
Replace interpolated values with clear references to XML tags and add
explicit formatting instructions. This makes it clearer how to use the
GitHub display name when available while maintaining the username for
the email portion.
Changes:
- Use explicit references to <trigger_display_name> and <trigger_username> tags
- Add clear formatting instructions and example
- Explain fallback behavior when display name is not available
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* feat: fetch trigger user display name via dedicated GraphQL query
Instead of trying to extract the display name from existing data (which
was incomplete due to Actor type limitations), we now:
- Add a dedicated USER_QUERY to fetch user display names
- Pass the trigger username to fetchGitHubData
- Fetch the display name during data collection phase
- Simplify prepareContext to use the pre-fetched display name
This ensures we always get the correct display name for Co-authored-by
trailers, regardless of where the trigger came from.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: ashwin-ant <ashwin-ant@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
* fix: add baseUrl to Octokit initialization in update_claude_comment
Fixes Bad credentials error on GitHub Enterprise Server by passing
GITHUB_API_URL as baseUrl when initializing Octokit, consistent with
other Octokit instances in the codebase.
Fixes#156
Related to #107
Co-authored-by: ashwin-ant <ashwin-ant@users.noreply.github.com>
* fix: pass GITHUB_API_URL as env var to MCP server
Update the MCP server initialization to pass GITHUB_API_URL as an
environment variable, allowing it to work correctly with GitHub
Enterprise Server instances.
Co-authored-by: ashwin-ant <ashwin-ant@users.noreply.github.com>
* fix: import GITHUB_API_URL from config in install-mcp-server
Use the centralized GITHUB_API_URL constant from src/github/api/config.ts instead of reading directly from process.env when passing environment variables to the MCP server. This ensures consistency with how the API URL is handled throughout the codebase.
Co-authored-by: ashwin-ant <ashwin-ant@users.noreply.github.com>
* fix
---------
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: ashwin-ant <ashwin-ant@users.noreply.github.com>
Add MultiEdit tool to the BASE_ALLOWED_TOOLS array to enable Claude Code to use the MultiEdit tool for making multiple edits to a single file in one operation.
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: ashwin-ant <ashwin-ant@users.noreply.github.com>
* fix: only load GitHub MCP server when its tools are allowed
- Add allowedTools parameter to prepareMcpConfig
- Check for mcp__github__ and mcp__github_file_ops__ tool prefixes
- Only include MCP servers when their tools are in allowed_tools
- Maintain backward compatibility when allowed_tools is not specified
- Update tests to reflect the new conditional loading behavior
This optimizes resource usage by not loading unnecessary MCP servers
when their tools are not allowed in the configuration.
Co-authored-by: ashwin-ant <ashwin-ant@users.noreply.github.com>
* fix: always load github_file_ops server regardless of allowed_tools
- Only apply conditional loading to the github MCP server
- Always load github_file_ops server as it contains essential tools
- Update tests to reflect this behavior
Co-authored-by: ashwin-ant <ashwin-ant@users.noreply.github.com>
* refactor: move allowedTools/disallowedTools parsing to parseGitHubContext
- Change allowedTools and disallowedTools from string to string[] in ParsedGitHubContext type
- Parse comma-separated environment variables into arrays in parseGitHubContext function
- Update create-prompt and install-mcp-server to use pre-parsed arrays
- Update all affected test files to use array syntax
- Eliminate duplicate parsing logic across the codebase
* style: apply prettier formatting
---------
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: ashwin-ant <ashwin-ant@users.noreply.github.com>
* feat: add unified update_claude_comment tool
- Add new update_claude_comment tool that automatically handles both issue and PR comments
- Remove individual update_issue_comment and update_pull_request_comment tools
- Pass CLAUDE_COMMENT_ID, GITHUB_EVENT_NAME, and IS_PR to MCP server environment
- Simplify Claude's comment update workflow by removing need for owner/repo/commentId params
- Update prompts and tests to use the new unified tool
* feat: add unified update_claude_comment tool
- Add new update_claude_comment tool that automatically handles both issue and PR comments
- Remove individual update_issue_comment and update_pull_request_comment tools
- Pass CLAUDE_COMMENT_ID, GITHUB_EVENT_NAME, and IS_PR to MCP server environment
- Use Octokit instead of raw fetch for better type safety and error handling
- Simplify Claude's comment update workflow by removing need for owner/repo/commentId params
- Update prompts and tests to use the new unified tool
* refactor: extract update_claude_comment logic to standalone testable function
- Create new updateClaudeComment function in operations/comments
- Add comprehensive unit tests following image-downloader pattern
- Update MCP server to use extracted function
- Refactor update-comment-link.ts and update-with-branch.ts to eliminate duplication
- All tests passing (10 new tests for update-claude-comment)
Co-authored-by: ashwin-ant <ashwin-ant@users.noreply.github.com>
* prettier
* tsc
* clean up comments
---------
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: ashwin-ant <ashwin-ant@users.noreply.github.com>
The last message in the Claude Code output does not have a role, but instead has a field "type" set to "result". With the current condition, the duration is never appended to the header of the comments.
- Add FAQ.md with sections on triggering, authentication, capabilities, and troubleshooting
- Document key limitations including workflow access, PR creation, and CI results visibility
- Include workarounds for common issues like automated workflows and test result access
- Cover security considerations and best practices for safe usage
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-authored-by: Claude <noreply@anthropic.com>
* Add enhanced text sanitization
* Format code with prettier
* Refactor tests to remove redundancy and improve structure
- Remove redundant 'mixed input patterns' test from sanitizer.test.ts
- Consolidate integration tests into 2 focused real-world scenarios
- Add HTML comment stripping to sanitizeContent function
- Update test expectations to match sanitization behavior
- Maintain full coverage with fewer, more focused tests
* Fix prettier formatting
* Remove rendered.html from repository
* Remove test-markdown.json and update .gitignore
* Revert .gitignore changes
* feat: add base_branch input to specify source branch for new Claude branches
- Add base_branch input parameter to action.yml allowing users to specify which branch to use as source
- Update setupBranch function to accept and use the base branch parameter
- Defaults to repository default branch if no base branch is specified
- Addresses issue #62 for better branch control
Co-authored-by: ashwin-ant <ashwin-ant@users.noreply.github.com>
* perf: optimize setupBranch to avoid unnecessary default branch fetch
Only fetch repository default branch when actually needed:
- Skip initial fetch when baseBranch is provided
- Fetch default branch at end only for return value and GitHub Actions output
- Eliminates unnecessary API call when users specify base branch
Co-authored-by: ashwin-ant <ashwin-ant@users.noreply.github.com>
* fix: properly handle base branch throughout the action workflow
- Fix TypeScript error where defaultBranch was used before being assigned
- Replace DEFAULT_BRANCH with BASE_BRANCH in subsequent workflow steps
- Update PR creation and branch comparison to use the actual base branch
- Ensure custom base_branch input is respected in all operations
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* refactor: move BASE_BRANCH env reading into parseGitHubContext
- Move BASE_BRANCH environment variable reading into parseGitHubContext for consistency
- Update setupBranch to use context.inputs.baseBranch instead of process.env
- Fix test descriptions to correctly reference BASE_BRANCH instead of DEFAULT_BRANCH
- Update test environment setup to use BASE_BRANCH
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: ashwin-ant <ashwin-ant@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
* feat: display detailed error messages when prepare step fails
- Capture prepare step errors in action.yml (up to 2000 chars)
- Add error details to comment update with collapsible section
- Handle both prepare and Claude execution failures separately
- Add test coverage for error detail display
This helps users debug issues like git errors, permission problems,
and branch creation failures more easily.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* refactor: simplify error capture to show clean error messages only
- Remove complex shell script that captured full output logs
- Use core.setOutput in prepare.ts to pass clean error message directly
- Avoid exposing potentially sensitive information from logs
- Show only the actual error message (e.g. 'Failed to fetch issue data')
This provides cleaner, more readable error messages without the risk
of exposing sensitive information from debug logs.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* refactor: simplify error display to show clean error messages only
- Remove collapsible <details> section for error messages
- Display errors in simple code blocks since messages are now clean and short
- Makes error messages more direct and readable
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
* feat: allow user override of hardcoded disallowed tools
Allow users to override hardcoded disallowed tools (WebSearch, WebFetch) by including them in their allowed_tools configuration. This provides users with the ability to control tool access based on their security requirements.
Changes:
- Modified buildDisallowedToolsString() to accept allowedTools parameter
- Added logic to filter out hardcoded disallowed tools if present in allowed tools
- Updated function call site to pass allowedTools
- Added comprehensive test coverage for override behavior
- Maintains backward compatibility
Resolves#49
Co-authored-by: ashwin-ant <ashwin-ant@users.noreply.github.com>
* prettier
---------
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: ashwin-ant <ashwin-ant@users.noreply.github.com>
* Add shallow fetch to improve performance for large repositories
This change adds `--depth=1` to git fetch operations to perform shallow
fetches instead of full history downloads. This significantly reduces
checkout time for large repositories as reported in issue #52.
Changes:
- Line 55: Added --depth=1 to PR branch fetch
- Line 102: Added --depth=1 to new branch fetch
Fixes#52
Co-authored-by: ashwin-ant <ashwin-ant@users.noreply.github.com>
* fetch 50 commits for PRs
---------
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: ashwin-ant <ashwin-ant@users.noreply.github.com>
- Add helpful hint about workflow permissions when OIDC token is not found
- Include response body in app token exchange failure errors for better debugging
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-authored-by: Claude <noreply@anthropic.com>
- Add error field to MCP error responses to fix 'undefined' errors
- Add REPO_DIR environment variable to fix file path resolution
- Use GITHUB_WORKSPACE for correct repository directory
- Simplify path processing logic in commit_files tool
This fixes the issue where mcp__github_file_ops__commit_files would fail
with 'Error calling tool commit_files: undefined' by ensuring error messages
are properly formatted and files are read from the correct directory.
This updates claude-code-action to pass the model parameter to claude-code-base-action using the new primary `model` parameter instead of the deprecated `anthropic_model`.
This change is made in conjunction with https://github.com/anthropics/claude-code-base-action/pull/4 which adds the `model` parameter to claude-code-base-action.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add stripHtmlComments function to remove HTML comments from text
- Apply to all GitHub content (bodies, comments, reviews, triggers)
- Add comprehensive tests for comment stripping functionality