Skip to content

feat: Add Claude Code GitHub Action for AI-assisted PR fixes via @simili-bot comments #105

@Kavirubc

Description

@Kavirubc

Summary

Add a Claude Code GitHub Action that allows PR authors to request AI-assisted code fixes by commenting @simili-bot <query> on a pull request. Claude Code will run in the context of the PR branch, perform the requested changes, and push a commit.

Motivation

When a PR is opened, automated review tools (CodeRabbit, GitHub Copilot, etc.) often leave comments with suggested improvements or flagged issues. Currently, the PR author must manually address each suggestion. This feature allows the author to tag @simili-bot with a natural language request, and Claude Code will automatically make the changes and commit them to the PR branch.

Proposed Behavior

  1. Trigger: A PR comment is created containing @simili-bot followed by a query/instruction
  2. Authorization: Only the PR author can trigger the bot (prevents unauthorized changes)
  3. Execution: Claude Code runs on the PR branch with the query as its prompt
  4. Result: Claude Code makes the requested changes and pushes a commit to the PR branch
  5. Feedback: The bot replies to the comment with a summary of what was done

Authentication

  • Uses OAuth token authentication (CLAUDE_CODE_OAUTH_TOKEN) for Pro/Max subscribers
  • No API key required — usage counts against the subscriber's plan limits
  • Token generated via claude setup-token and stored as a GitHub Actions secret

Example Usage

@simili-bot Fix the issues mentioned by CodeRabbit above regarding error handling
@simili-bot Add unit tests for the new processEvent function
@simili-bot Refactor this function to use early returns as suggested

Technical Details

  • New workflow file: .github/workflows/claude-code.yml
  • Uses anthropic/claude-code-action@v1
  • Triggered on issue_comment events (PR comments are issue comments in GitHub API)
  • Needs contents: write, pull-requests: write, issues: write permissions
  • Must filter to only run on PR comments (not issue comments)
  • Must prevent feedback loops (skip bot-authored comments)

Checklist

  • Create .github/workflows/claude-code.yml
  • Add CLAUDE_CODE_OAUTH_TOKEN as a repository secret
  • Test with a sample PR comment
  • Document usage in README or CONTRIBUTING.md

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions