-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat: implement Claude Code GitHub Action v1.0 with auto-detection and slash commands #421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…d slash commands Major features: - Mode auto-detection based on GitHub event type - Unified prompt field replacing override_prompt and direct_prompt - Slash command system with pre-built commands - Full backward compatibility with v0.x Key changes: - Add mode detector for automatic mode selection - Implement slash command loader with YAML frontmatter support - Update action.yml with new prompt input - Create pre-built slash commands for common tasks - Update all tests for v1.0 compatibility Breaking changes (with compatibility): - Mode input now optional (auto-detected) - override_prompt deprecated (use prompt) - direct_prompt deprecated (use prompt)
|
Claude finished @km-anthropic's task —— View job PR Review: Claude Code GitHub Action v1.0Comprehensive review completed. This is an excellent v1.0 release with well-designed architecture and strong backward compatibility. Tasks:
🎯 Overall AssessmentVerdict: Excellent v1.0 release - This is a well-architected major version upgrade with thoughtful design decisions and strong backward compatibility. ✅ StrengthsArchitecture & Design
Backward Compatibility
Code Quality
🔍 Technical Deep DiveMode Detection Logic (
|
BREAKING CHANGES: - Remove review mode entirely - now handled via slash commands in agent mode - Remove all deprecated backward compatibility fields (mode, anthropic_model, override_prompt, direct_prompt) - Simplify mode detection: prompt overrides everything, then @claude mentions trigger tag mode, default is agent mode - Remove slash command resolution from GitHub Action - Claude Code handles natively - Remove variable substitution - prompts passed through as-is Architecture changes: - Only two modes now: tag (for @claude mentions) and agent (everything else) - Agent mode is the default for all events including PRs - Users configure behavior via prompts/slash commands (e.g. /review) - GitHub Action is now a thin wrapper that passes prompts to Claude Code - Mode names changed: 'experimental-review' → removed entirely This aligns with the philosophy that the GitHub Action should do minimal work and delegate to Claude Code for all intelligent behavior.
- Remove duplicate prompt field spread (line 160) - Remove async from generatePrompt since slash commands are handled by Claude Code - Add detailed comment explaining why prompt → agent mode logic - Remove entire slash-commands loader and directories as Claude Code handles natively - Simplify prompt generation to just pass through to Claude Code These changes align with v1.0 philosophy: GitHub Action is a thin wrapper that delegates everything to Claude Code for native handling.
Resolved conflict by keeping deletion of src/modes/review/index.ts as review mode is removed in v1.0
These were added for slash-command YAML parsing but are no longer needed since we removed slash-command preprocessing entirely
The inline comment server configuration was checking for deprecated 'mode' field. Since review mode is removed in v1.0, this conditional block is no longer needed.
- Add claude_args input to both action.yml files - Implement shell-style argument parsing with quote handling - Pass arguments directly to Claude CLI for maximum flexibility - Add comprehensive tests for argument parsing - Log custom arguments for debugging Users can now pass any Claude CLI arguments directly: claude_args: '--max-turns 3 --mcp-config /path/to/config.json' This provides power users full control over Claude's behavior without waiting for specific inputs to be added to the action.
- Replace custom parseShellArgs with battle-tested shell-quote package - Simplify code by removing unnecessary -p filtering (Claude handles it) - Update tests to use shell-quote directly - Add example workflow showing claude_args usage This provides more robust argument parsing while reducing code complexity.
- Add claude_args input to action.yml for flexible CLI control - Parse arguments with industry-standard shell-quote library - Maintain proper argument order: -p [claudeArgs] [legacy] [BASE_ARGS] - Keep tag mode defaults (needed for functionality) - Agent mode has no defaults (full user control) - Add comprehensive tests for new functionality - Add example workflow showing usage
- Remove all backward compatibility for v1.0 simplification - Remove 10 legacy inputs from base-action/action.yml - Remove 9 legacy inputs from main action.yml - Simplify ClaudeOptions type to just timeoutMinutes and claudeArgs - Remove all legacy option handling from prepareRunConfig - Update tests to remove references to deleted fields - Remove obsolete test file github/context.test.ts - Clean up types to remove customInstructions, allowedTools, disallowedTools Users now use claudeArgs exclusively for CLI control.
- Change github_ci server logic to check for workflow token presence - Update test names to reflect new behavior - Fix test that was incorrectly setting workflow token
- Agent mode now only triggers when explicit prompt is provided - Removed automatic triggering for workflow_dispatch/schedule without prompt - Re-added additional_permissions input for requesting GitHub permissions - Fixed TypeScript types for mock context helpers to properly handle partial inputs - Updated documentation to reflect simplified mode behavior
This allows workflows to use the Claude App token obtained by the action for posting comments as claude[bot] instead of github-actions[bot]. Changes: - Add github_token output to action.yml - Export token from prepare.ts after authentication - Allows workflows to use the same token Claude uses internally
Agent mode now fetches the authenticated user (claude[bot] when using Claude App token) and configures git identity properly, matching the behavior of tag mode. This fixes the issue where commits in agent mode were failing due to missing git identity.
… into fix-workflow-run-auth
…tion into fix-workflow-run-auth
… commits - Read CLAUDE_BRANCH and BASE_BRANCH env vars in agent mode - Pass correct branch info to MCP file ops server - Enables signed auto-fix workflows to create branches via API
- Add auto-fix-ci example with inline git commits - Add auto-fix-ci-signed example with signed commits via MCP - Include corresponding slash commands for both workflows - Examples demonstrate automated CI failure detection and fixing
- Remove dependency on configureGitAuth which expects ParsedGitHubContext - Implement git configuration directly for automation contexts - Properly handle git authentication for agent mode
- Use GITHUB_SERVER_URL from config module consistently - Remove existing headers before setting new ones - Use remote URL with embedded token like git-config.ts does - Match the existing git authentication pattern in the codebase
- Update configureGitAuth to accept GitHubContext instead of ParsedGitHubContext - This allows both tag mode and agent mode to use the same function - Removes code duplication and ensures consistent git configuration
When the github_file_ops MCP server gets a 403 error, it now shows a cleaner message suggesting to rebase from main/master branch to fix the issue.
* docs: Update documentation for v1.0 release - Integrate breaking changes naturally without alarming users - Replace deprecated inputs (direct_prompt, custom_instructions, mode) with new unified approach - Update all examples to use prompt and claude_args instead of deprecated inputs - Add migration guides to help users transition from v0.x to v1.0 - Emphasize automatic mode detection as a key feature - Update all workflow examples to @v1 from @beta - Document how claude_args provides direct CLI control - Update FAQ with automatic mode detection explanation - Convert all tool configuration to use claude_args format * fix: Apply prettier formatting to documentation files * fix: Update all Claude model versions to latest and improve documentation accuracy - Update all model references to claude-4-0-sonnet-20250805 (latest Sonnet 4) - Update Bedrock models to anthropic.claude-4-0-sonnet-20250805-v1:0 - Update Vertex models to claude-4-0-sonnet@20250805 - Fix cloud-providers.md to use claude_args instead of deprecated model input - Ensure all examples use @v1 instead of @beta - Keep claude-opus-4-1-20250805 in examples where Opus is demonstrated - Align all documentation with v1.0 patterns consistently * feat: Add dedicated migration guide as requested in PR feedback - Create comprehensive migration-guide.md with step-by-step instructions - Add prominent links to migration guide in README.md - Update usage.md to reference the separate migration guide - Include before/after examples for all common scenarios - Add checklist for systematic migration - Address Ashwin's feedback about having a separate, clearly linked migration guide
- Add dedicated issue deduplication workflow example - Add issue triage example (moved from .github/workflows) - Update all examples to use v1-dev branch consistently - Enable MCP tools in claude-auto-review.yml - Consolidate PR review examples into single comprehensive example Hero use cases now covered: 1. Code reviews (claude-auto-review.yml) 2. Issue triaging (issue-triage.yml) 3. Issue deduplication (issue-deduplication.yml) 4. Auto-fix CI failures (auto-fix-ci/auto-fix-ci.yml) All examples updated to follow v1-dev paradigm with proper prompt and claude_args configuration.
|
|
||
| await $`cp ${projectAgentsDir}/*.md ${claudeAgentsDir}/ 2>/dev/null || true`.quiet(); | ||
|
|
||
| const agentFiles = await $`ls ${claudeAgentsDir}/*.md 2>/dev/null | wc -l` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I, a non-contributor, may,
Both cp and ls do sometimes (rarely) emit warnings to stderr. Correctly bubbling them up through the plumbing of any system is a PITA, and in the olden days this extremely insane style of programming was enough of a chore to be unworkable, but I find Opus 4 and 4.1 can do at least as tastefully as when I do it by hand, and with 10x less effort.
The rationale for detecting and bubbling up such rare cases is that those tend to be the most surprising and confusing issues. It's usually not worth trying to handle anything like the errors that cp and ls might emit to stderr, but bubbling them up gives key context to developers (AI or human) that might be incredibly valuable. I've spent an unreasonable number of hours over the course of my career that I eventually traced back to suppressed or swallowed warnings and errors in third party or upstream code.
Usually what I end up doing when scripting is emitting nothing in the happy path, but capturing any stderr output, logging it separately at the callsite, and at the end of the script, emitting a summary of the number of errors emitted (if any). The final summary is the low noise useful cue for developers that there's something amiss.
This change removes the custom timeout_minutes parameter from the action in favor of using GitHub Actions' native timeout-minutes feature. Changes: - Removed timeout_minutes input from action.yml and base-action/action.yml - Removed all timeout handling logic from base-action/src/run-claude.ts - Updated base-action/src/index.ts to remove timeoutMinutes parameter - Removed timeout-related tests from base-action/test/run-claude.test.ts - Removed timeout_minutes from all example workflow files (19 files) Rationale: - Simplifies the codebase by removing custom timeout logic - Users can use GitHub Actions' native timeout-minutes at the job/step level - Reduces complexity and maintenance burden - Follows GitHub Actions best practices BREAKING CHANGE: The timeout_minutes parameter is no longer supported. Users should use GitHub Actions' native timeout-minutes instead. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Claude <[email protected]>
Removes experimental file copying features that had no default content: - Removed experimental_slash_commands_dir parameter and related logic - Removed automatic project agents copying from .claude/agents/ - Eliminated flaky error-prone cp operations with stderr suppression - Removed 175 lines of unused code and associated tests These features were infrastructure without default content that used problematic error handling patterns (2>/dev/null || true) which could hide real filesystem errors. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
The timeout_minutes parameter was removed in commit 986e40a but documentation still referenced it. This updates: - docs/usage.md: Removed timeout_minutes from inputs table - base-action/README.md: Removed from inputs table and example 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Remove third argument from setupClaudeCodeSettings call in index.ts - Remove unused 'readdir' import from test file 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Major features:
Key changes:
Breaking changes (with compatibility):