Skip to content

Develop#646

Merged
MervinPraison merged 2 commits intomainfrom
develop
Jun 15, 2025
Merged

Develop#646
MervinPraison merged 2 commits intomainfrom
develop

Conversation

@MervinPraison
Copy link
Copy Markdown
Owner

@MervinPraison MervinPraison commented Jun 15, 2025

PR Type

Enhancement


Description

• Add Docker-based Claude Code GitHub Action with authentication
• Create comprehensive Claude Code integration documentation
• Update workflow to use custom Docker image
• Add GitHub token support for repository access


Changes walkthrough 📝

Relevant files
Enhancement
entrypoint.sh
Add Claude Code action entrypoint script                                 

.github/actions/claude-code-action/entrypoint.sh

• Create shell script entrypoint for Claude Code execution
• Set up
environment variables for API keys and GitHub token
• Execute Claude
with smart prompt for GitHub context analysis

+15/-0   
Dockerfile
Create Docker image for Claude Code action                             

.github/actions/claude-code-action/Dockerfile

• Create Docker image based on Node.js Alpine
• Install Claude Code
CLI globally via npm
• Set up executable entrypoint script

+9/-0     
action.yml
Define Claude Code GitHub Action configuration                     

.github/actions/claude-code-action/action.yml

• Define GitHub Action with required inputs for API keys
• Configure
Docker-based execution using custom image
• Set up argument passing
for authentication tokens

+17/-0   
action.yml
Add full-featured Claude Code composite action                     

.github/actions/claude-code/action.yml

• Create comprehensive composite action for Claude Code
• Add multiple
configuration options and tool management
• Include GitHub MCP server
installation and timeout handling
• Support both prompt text and
file-based inputs

+117/-0 
claude.yml
Update Claude workflow to use custom Docker image               

.github/workflows/claude.yml

• Update workflow to use custom Docker image
• Add GitHub token input
for repository access
• Change from Anthropic's action to custom
implementation

+2/-1     
Documentation
CLAUDE_CODE_INTEGRATION_PRAISONAI_AGENTS.md
Add comprehensive Claude Code integration documentation   

src/praisonai/tests/CLAUDE_CODE_INTEGRATION_PRAISONAI_AGENTS.md

• Add comprehensive 291-line integration documentation
• Document
agent-driven decision making and tool architecture
• Include usage
examples, configuration options, and troubleshooting
• Cover git
integration, error handling, and migration guide

[link]   

Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • Summary by CodeRabbit

    • New Features
      • Introduced a new GitHub Action, "Claude Code Action," enabling integration of Claude Code into GitHub workflows.
      • Added support for customizable inputs, including API keys, prompt configuration, allowed tools, output handling, and timeout settings.
    • Chores
      • Updated workflow to use a direct Docker container image for the Claude Code Action.
      • Added supporting files for action setup and execution within CI environments.

    … needed for the integration of Claude Code with PraisonAI Agents. This deletion simplifies the documentation and reflects the current state of the project.
    @coderabbitai
    Copy link
    Copy Markdown
    Contributor

    coderabbitai bot commented Jun 15, 2025

    Caution

    Review failed

    The pull request is closed.

    Walkthrough

    This change introduces a new Docker-based GitHub Action for running Claude Code, including a Dockerfile, shell entrypoint, and action metadata. The workflow is updated to use the new container image and passes both Anthropic API and GitHub tokens as inputs. A composite action version is also added for flexible usage.

    Changes

    File(s) Change Summary
    .github/actions/claude-code-action/Dockerfile, entrypoint.sh, action.yml Added a new Docker-based GitHub Action for Claude Code, including Dockerfile, entrypoint script, and config.
    .github/actions/claude-code/action.yml Introduced a composite GitHub Action for Claude Code with configurable inputs, prompt handling, and output processing.
    .github/workflows/claude.yml Updated workflow to use the new Docker container image and added github_token input to the action step.

    Sequence Diagram(s)

    sequenceDiagram
        participant GitHub Actions
        participant Claude Code Action (Docker/Composite)
        participant Claude CLI
        participant Anthropic API
        participant GitHub API
    
        GitHub Actions->>Claude Code Action (Docker/Composite): Start Action (with API keys, prompt)
        Claude Code Action (Docker/Composite)->>Claude CLI: Install and configure CLI
        Claude Code Action (Docker/Composite)->>Claude CLI: Prepare prompt and environment
        Claude CLI->>Anthropic API: Send prompt and context
        Claude CLI->>GitHub API: (If needed) Fetch repo/PR/issue context
        Anthropic API-->>Claude CLI: Return response
        Claude CLI-->>Claude Code Action (Docker/Composite): Output result
        Claude Code Action (Docker/Composite)-->>GitHub Actions: Save and log output
    
    Loading

    Possibly related PRs

    • MervinPraison/PraisonAI#646: Contains the same GitHub Action "Claude Code Action" with identical Dockerfile, action.yml, entrypoint.sh, and workflow changes, indicating direct relation.
    • MervinPraison/PraisonAI#486: Introduced the original Claude Code GitHub Actions workflow using the marketplace action, related by workflow and action usage but differing in implementation.

    Suggested labels

    Review effort 3/5

    Poem

    🐇
    In the warren of code, a Docker hops in,
    With Claude at its side, let the prompts begin!
    Tokens in paw, it scurries with glee,
    Spinning up actions for all to see.
    Now with a script and a workflow anew,
    The rabbit brings Claude’s magic to you!
    🥕✨


    📜 Recent review details

    Configuration used: CodeRabbit UI
    Review profile: CHILL
    Plan: Pro

    📥 Commits

    Reviewing files that changed from the base of the PR and between 00d94e7 and 7388713.

    📒 Files selected for processing (5)
    • .github/actions/claude-code-action/Dockerfile (1 hunks)
    • .github/actions/claude-code-action/action.yml (1 hunks)
    • .github/actions/claude-code-action/entrypoint.sh (1 hunks)
    • .github/actions/claude-code/action.yml (1 hunks)
    • .github/workflows/claude.yml (1 hunks)
    ✨ Finishing Touches
    • 📝 Generate Docstrings

    Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

    ❤️ Share
    🪧 Tips

    Chat

    There are 3 ways to chat with CodeRabbit:

    • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
      • I pushed a fix in commit <commit_id>, please review it.
      • Explain this complex logic.
      • Open a follow-up GitHub issue for this discussion.
    • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
      • @coderabbitai explain this code block.
      • @coderabbitai modularize this function.
    • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
      • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
      • @coderabbitai read src/utils.ts and explain its main purpose.
      • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
      • @coderabbitai help me debug CodeRabbit configuration file.

    Support

    Need help? Create a ticket on our support page for assistance with any issues or questions.

    Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

    CodeRabbit Commands (Invoked using PR comments)

    • @coderabbitai pause to pause the reviews on a PR.
    • @coderabbitai resume to resume the paused reviews.
    • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
    • @coderabbitai full review to do a full review from scratch and review all the files again.
    • @coderabbitai summary to regenerate the summary of the PR.
    • @coderabbitai generate docstrings to generate docstrings for this PR.
    • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
    • @coderabbitai resolve resolve all the CodeRabbit review comments.
    • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
    • @coderabbitai help to get help.

    Other keywords and placeholders

    • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
    • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
    • Add @coderabbitai anywhere in the PR title to generate the title automatically.

    CodeRabbit Configuration File (.coderabbit.yaml)

    • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
    • Please see the configuration documentation for more information.
    • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

    Documentation and Community

    • Visit our Documentation for detailed information on how to use CodeRabbit.
    • Join our Discord Community to get help, request features, and share feedback.
    • Follow us on X/Twitter for updates and announcements.

    @MervinPraison MervinPraison merged commit 6720e49 into main Jun 15, 2025
    5 of 13 checks passed
    Copy link
    Copy Markdown
    Contributor

    @gemini-code-assist gemini-code-assist bot left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Summary of Changes

    Hello @MervinPraison, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

    This pull request integrates Claude Code into GitHub workflows by adding two distinct GitHub Actions. One is a straightforward Docker action intended for automated CI analysis, while the other is a more configurable composite action providing flexibility for various use cases, including prompt customization, tool usage, and output management.

    Highlights

    • New GitHub Actions: This PR introduces two new GitHub Actions under the .github/actions directory: claude-code-action and claude-code.
    • Docker-based Action (claude-code-action): A simple Docker-based action is added, designed to run claude-code with a predefined prompt suitable for CI contexts (like analyzing PRs/issues). It requires anthropic_api_key and github_token inputs.
    • Composite Action (claude-code): A more flexible composite action is added, allowing users to provide prompts via input or file, specify allowed tools, set timeouts, and optionally save the output to a file. It also includes a step to install the GitHub MCP server if configured.
    • Prompt Handling: The composite action includes logic to handle prompts provided directly as input or loaded from a specified file, ensuring one is provided and is not empty.
    • Output Handling: The composite action can optionally save the final Claude Code response to a specified file by processing the stream-json output.
    Using Gemini Code Assist

    The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

    Invoking Gemini

    You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

    Feature Command Description
    Code Review /gemini review Performs a code review for the current pull request in its current state.
    Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
    Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
    Help /gemini help Displays a list of available commands.

    Customization

    To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

    Limitations & Feedback

    Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

    You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

    Footnotes

    1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configureGemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

    @qodo-code-review
    Copy link
    Copy Markdown

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
    🧪 No relevant tests
    🔒 Security concerns

    Sensitive information exposure:
    API keys are passed as command line arguments in the entrypoint script (lines 11-12 in entrypoint.sh), making them visible in process lists, system logs, and potentially in CI/CD logs. This creates a significant security risk as the ANTHROPIC_API_KEY could be exposed. The script should receive these values through environment variables instead of command line arguments.

    ⚡ Recommended focus areas for review

    Security Risk

    API keys are passed as command line arguments which can be visible in process lists and logs. Environment variables should be used instead for sensitive data.

    export ANTHROPIC_API_KEY="$1"
    export GITHUB_TOKEN="$2"
    Syntax Error

    Invalid GitHub Actions syntax in the conditional format expression that will cause workflow failures during execution.

        ${{ inputs.allowed_tools != '' && format('--allowedTools "{0}"', inputs.allowed_tools) || '' }}
    else
    Configuration Issue

    Inconsistent Docker image references between action definition and workflow usage, and incorrect YAML indentation that will prevent proper execution.

    uses: docker://ghcr.io/mervinpraison/praisonai-claudecode:latest
    with:
      anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
      github_token: ${{ secrets.GH_TOKEN }}

    @qodo-code-review
    Copy link
    Copy Markdown

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    Fix argument format mismatch

    The arguments format is inconsistent with the shell script which expects
    positional arguments, not named flags. The entrypoint.sh script expects $1 and
    $2 but receives named arguments that won't be parsed correctly.

    .github/actions/claude-code-action/action.yml [15-17]

     args:
    -  - "--anthropic-api-key=${{ inputs.anthropic_api_key }}"
    -  - "--github-token=${{ inputs.github_token }}"
    +  - "${{ inputs.anthropic_api_key }}"
    +  - "${{ inputs.github_token }}"
    • Apply / Chat
    Suggestion importance[1-10]: 10

    __

    Why: This suggestion points out a critical bug. The entrypoint.sh script expects positional arguments ($1, $2), but the action.yml passes named arguments. This mismatch would cause the action to fail by setting incorrect environment variables. The proposed fix is correct and essential for the action to function.

    High
    Fix incorrect input reference case

    The input reference is incorrect - it should use lowercase github_token to match
    the defined input name. This will cause the GitHub MCP server to fail
    authentication due to undefined environment variable.

    .github/actions/claude-code/action.yml [58]

    -"GITHUB_PERSONAL_ACCESS_TOKEN": "${{ inputs.GITHUB_TOKEN }}"
    +"GITHUB_PERSONAL_ACCESS_TOKEN": "${{ inputs.github_token }}"
    • Apply / Chat
    Suggestion importance[1-10]: 10

    __

    Why: This suggestion identifies a critical bug. The action defines an input as github_token, but it is referenced as inputs.GITHUB_TOKEN. GitHub Actions context is case-insensitive for github and secrets objects, but case-sensitive for inputs. This would result in an empty value being passed, causing authentication to fail. The fix is correct and essential.

    High
    Add argument validation and error handling

    The script lacks proper error handling and validation for required arguments.
    Add argument validation and error handling to ensure the script fails gracefully
    when required parameters are missing or invalid.

    .github/actions/claude-code-action/entrypoint.sh [14-15]

    +# Validate required arguments
    +if [ -z "$1" ] || [ -z "$2" ]; then
    +    echo "Error: Missing required arguments. Usage: $0 <ANTHROPIC_API_KEY> <GITHUB_TOKEN>"
    +    exit 1
    +fi
    +
     # Run Claude with the prompt
    -claude -p "$PROMPT"
    +claude -p "$PROMPT" || {
    +    echo "Error: Claude execution failed"
    +    exit 1
    +}
    • Apply / Chat
    Suggestion importance[1-10]: 8

    __

    Why: The suggestion correctly identifies that the script lacks validation for its input arguments ($1 and $2) and error handling for the claude command. Implementing this change significantly improves the script's robustness and provides clearer error messages, which is crucial for a reusable GitHub Action.

    Medium
    • More

    Copy link
    Copy Markdown
    Contributor

    @gemini-code-assist gemini-code-assist bot left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Code Review

    This pull request introduces new GitHub Actions for integrating Claude Code. It adds a Docker-based action for direct execution and a more comprehensive composite action with features like prompt file handling, tool management, and output saving. Additionally, detailed documentation for Claude Code integration has been included.

    My review focuses on improving the robustness, correctness, and stability of these new actions. Key suggestions include correcting argument parsing in the entrypoint script, pinning Docker image versions, using safer shell commands for file writing, and enhancing error handling in shell pipelines. These changes will help ensure the actions are reliable and maintainable.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    1 participant