Skip to content

Conversation

@andrew8088
Copy link

@andrew8088 andrew8088 commented Jul 4, 2025

We want to be able to write the clod code review to multiple locations, not just commenting on a pull request, but also commenting directly on a commit or even just writing the review to stdout.

Claude Code's summary after writing the code:

New Features Added:

  1. Action Inputs (action.yml):
  • output_mode: Comma-separated list supporting pr_comment, commit_comment, stdout
  • commit_sha: Optional specific commit SHA for commit comments
  1. Strategy Pattern Architecture:
  • OutputStrategy interface for consistent implementation
  • PrCommentStrategy: Existing PR/issue comment logic (refactored)
  • CommitCommentStrategy: Creates comments on specific commits
  • StdoutStrategy: Outputs to workflow logs in plain text format
  1. OutputManager Class:
  • Parses and validates output mode configurations
  • Handles multiple output strategies simultaneously
  • Provides error resilience (continues if some strategies fail)
  • Maintains backward compatibility
  1. Updated Entry Points:
  • prepare.ts: Uses OutputManager for initial tracking
  • update-comment-link.ts: Uses OutputManager for final results

Key Features:

✅ Backward Compatibility: Default output_mode: "pr_comment" preserves existing behavior

✅ Flexible Configuration:

  • output_mode: "pr_comment" - Traditional PR comments (default)
  • output_mode: "commit_comment" - Comments on specific commits
  • output_mode: "stdout" - Plain text output to workflow logs
  • output_mode: "pr_comment,stdout" - Multiple outputs simultaneously

✅ Smart Commit Resolution:

  1. Uses explicit commit_sha if provided
  2. Falls back to PR HEAD commit
  3. Falls back to workflow commit SHA

✅ Error Handling: Individual strategy failures don't break the entire action

✅ Context Validation: Ensures output modes are valid for the GitHub context

The implementation successfully makes the GitHub Action's review output more general and configurable while maintaining full backward
compatibility.

@andrew8088 andrew8088 merged commit 365ecec into main Jul 4, 2025
3 checks passed
dts pushed a commit that referenced this pull request Oct 8, 2025
…rly (anthropics#178)

* 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 <[email protected]>

* Adjust IssuesAssignedEvent import position (#2)

---------

Co-authored-by: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants