Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 9 additions & 19 deletions .github/workflows/claude-comment-response.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,33 +25,23 @@ jobs:
# If running on a PR comment, we need to explicitly check out the PR branch
- name: Checkout PR branch if needed
if: github.event.issue.pull_request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Get the PR number from the issue object
PR_NUMBER="${{ github.event.issue.number }}"
echo "Fetching PR #${PR_NUMBER} details..."

echo "Checking out PR #${PR_NUMBER}"

# Get PR info
PR_INFO=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/${{ github.repository }}/pulls/$PR_NUMBER")

# Extract the PR branch ref and other details
PR_BRANCH=$(echo "$PR_INFO" | jq -r .head.ref)
PR_SHA=$(echo "$PR_INFO" | jq -r .head.sha)
PR_REPO=$(echo "$PR_INFO" | jq -r .head.repo.full_name)
# Use the GitHub CLI to get PR details
gh pr view $PR_NUMBER --json headRefName,headRepository --jq '.headRefName, .headRepository.nameWithOwner'

echo "PR branch is $PR_BRANCH from repo $PR_REPO with commit SHA $PR_SHA"
# Checkout the PR using the GitHub CLI - this handles forks automatically
echo "Checking out PR #${PR_NUMBER}..."
gh pr checkout $PR_NUMBER

# Fetch the PR as a local branch (works for forks too)
git fetch origin "pull/$PR_NUMBER/head:pr-$PR_NUMBER"
git checkout "pr-$PR_NUMBER"

# Verify checkout
echo "Current branch details:"
git status
git rev-parse HEAD
git branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Claude Response
uses: anthropics/claude-code-action@beta
Expand Down
22 changes: 21 additions & 1 deletion .github/workflows/claude-pr-creation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,27 @@ jobs:
with:
fetch-depth: 0 # Fetch full history for accurate diffs

# If running on a PR comment, we need to explicitly check out the PR branch
- name: Checkout PR branch if needed
if: github.event.issue.pull_request
run: |
# Get the PR number from the issue object
PR_NUMBER="${{ github.event.issue.number }}"
echo "Fetching PR #${PR_NUMBER} details..."

# Use the GitHub CLI to get PR details
gh pr view $PR_NUMBER --json headRefName,headRepository --jq '.headRefName, .headRepository.nameWithOwner'
Comment thread
allisoneer marked this conversation as resolved.
Outdated

# Checkout the PR using the GitHub CLI - this handles forks automatically
echo "Checking out PR #${PR_NUMBER}..."
gh pr checkout $PR_NUMBER

echo "Current branch details:"
git status
git branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Claude PR Creation
uses: anthropics/claude-code-action@beta
with:
Expand Down Expand Up @@ -66,7 +87,6 @@ jobs:
GrepTool # Search file contents
BatchTool # Run multiple tools in parallel


# Timeout after 30 minutes for potentially complex implementations
timeout_minutes: 30

Expand Down
Loading