Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Fix Claude workflow to properly checkout PR branches from forks

Manav Rathi89f19f199a86
diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml
index 0f5f90a70f..e624858700 100644
--- a/.github/workflows/claude.yml
+++ b/.github/workflows/claude.yml
@@ -38,8 +38,25 @@ jobs:
id-token: write
actions: read # Required for Claude to read CI results on PRs
steps:
+ # For issue_comment events on PRs, we need to fetch the PR details first
+ - name: Get PR details
+ if: github.event_name == 'issue_comment' && github.event.issue.pull_request
+ id: pr_details
+ uses: octokit/[email protected]
+ with:
+ route: ${{ github.event.issue.pull_request.url }}
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ # Checkout the correct ref based on the event type
- name: Checkout repository
uses: actions/checkout@v4
+ with:
+ # For PR comments from forks, use the PR head SHA
+ # For other events, use the default behavior
+ ref: ${{ (github.event_name == 'issue_comment' && github.event.issue.pull_request) && fromJson(steps.pr_details.outputs.data).head.sha || '' }}
+ # Also specify the repository for fork PRs
+ repository: ${{ (github.event_name == 'issue_comment' && github.event.issue.pull_request && fromJson(steps.pr_details.outputs.data).head.repo.full_name != github.repository) && fromJson(steps.pr_details.outputs.data).head.repo.full_name || github.repository }}
- name: Run Claude Code
id: claude