Fork Modifications

Learn about the specific modifications made to improve pull request creation in the claude-code-action.

GitHub CLI Integration

Uses gh pr create commands

Enhanced Reliability

Eliminates hardcoded URL issues

Claude Code Action Fork Modifications

This page documents the specific modifications made to the claude-code-action GitHub Action for improved pull request creation workflows.

Overview

Our workflows use a customized fork of the official anthropics/claude-code-action that includes targeted improvements for pull request creation. The fork is maintained at:

Fork Repository: 0xthrpw/claude-code-action

Original Repository: anthropics/claude-code-action

Modifications Made

The fork includes two specific commits that improve the pull request creation workflow:

1. GitHub CLI Integration (Commit ff91afe)

Changes Made:

  • Package Name Update: Changed package name from @anthropic-ai/claude-code-action to @0xthrpw/claude-code-action
  • Tool Permissions: Modified getAllowedTools() in both agent and tag modes to return ["Bash(gh pr create *)"]
  • Workflow Simplification: Replaced manual PR creation instructions with GitHub CLI commands
  • Test Updates: Updated corresponding test files to reflect the new GitHub CLI approach

Benefits:

  • Streamlined PR creation process using gh pr create command
  • More reliable and consistent PR creation across different scenarios
  • Simplified workflow instructions for users

2. Enhanced PR Creation Logic (Commit 0db6b7f)

Changes Made:

  • Removed Hardcoded URLs: Eliminated explicit GitHub PR creation URL references
  • Standardized Commands: Replaced PR URL construction with gh pr create --base [branch] commands
  • Updated Tests: Modified test cases to expect gh pr create commands instead of manual URL construction
  • Cross-Mode Consistency: Applied changes across agent mode, tag mode, and testing contexts

Benefits:

  • More flexible PR creation that works with different repository configurations
  • Eliminates potential issues with hardcoded GitHub server URLs
  • Consistent behavior across different operating modes

Using the Fork in Your Workflows

To use the modified version in your workflows, update your workflow files to reference the fork:

- name: AI Response uses: 0xthrpw/claude-code-action@v0.0.1 # Using the fork continue-on-error: true timeout-minutes: 8 with: oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} github_token: ${{ steps.generate-token.outputs.token }} direct_prompt: | Your prompt here...

Note: Replace anthropics/claude-code-action@v0 with 0xthrpw/claude-code-action@v0.0.1 in your existing workflows.

Key Differences from Original

The modifications specifically improve how the action handles pull request creation:

GitHub CLI Integration

  • Tool Permissions: The action now allows Bash(gh pr create *) commands
  • Simplified Workflow: Instead of constructing PR URLs manually, the action uses gh pr create commands
  • Better Reliability: Eliminates potential issues with hardcoded GitHub server URLs

Example Behavior Change

Original Action:

  • Would construct GitHub PR URLs manually
  • Required specific URL formatting
  • Less flexible across different GitHub configurations

Modified Action:

  • Uses gh pr create --base [branch] commands
  • More flexible and reliable PR creation
  • Works consistently across different repository setups

Technical Details

The changes affect these key components:

File Modifications

  • src/create-prompt/index.ts: Added GitHub CLI tool permission
  • src/modes/agent/index.ts: Updated allowed tools for agent mode
  • src/modes/tag/index.ts: Updated allowed tools for tag mode
  • test/create-prompt.test.ts: Updated tests to expect gh pr create commands
  • package.json: Changed package name to @0xthrpw/claude-code-action

Testing Updates

All test cases were updated to reflect the new GitHub CLI approach, ensuring consistent behavior across different modes and scenarios.

Migration Guide

From Original Action

If you're currently using anthropics/claude-code-action, migrating to the fork is straightforward:

  1. Update Action Reference:

    # Old uses: anthropics/claude-code-action@v0 # New uses: 0xthrpw/claude-code-action@v0.0.1
  2. Test Thoroughly: Verify all existing functionality works as expected, especially any PR creation workflows

Rollback Strategy

If issues arise, you can easily rollback:

# Temporary rollback to original uses: anthropics/claude-code-action@v0

Summary

This fork makes focused improvements to the claude-code-action specifically around pull request creation:

  • Replaces manual PR URL construction with GitHub CLI commands
  • Provides more reliable PR creation across different GitHub configurations
  • Maintains full compatibility with existing workflow configurations
  • Updates package naming for clear distinction from the original

The changes are minimal and targeted, focusing specifically on improving the pull request creation workflow without adding unnecessary complexity or features.


These modifications improve the reliability of PR creation in AI-powered workflows by leveraging the GitHub CLI instead of manual URL construction.