diff --git a/action.yml b/action.yml index 6f4cccb..d9256c4 100644 --- a/action.yml +++ b/action.yml @@ -26,9 +26,24 @@ inputs: runs: using: 'composite' steps: + - name: Get PR info for fork support + if: github.event.issue.pull_request + id: pr-info + shell: bash + env: + GH_TOKEN: ${{ github.token }} + run: | + PR_DATA=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.issue.number }}) + echo "pr_head_owner=$(echo "$PR_DATA" | jq -r '.head.repo.owner.login')" >> $GITHUB_OUTPUT + echo "pr_head_repo=$(echo "$PR_DATA" | jq -r '.head.repo.name')" >> $GITHUB_OUTPUT + echo "pr_head_ref=$(echo "$PR_DATA" | jq -r '.head.ref')" >> $GITHUB_OUTPUT + echo "is_fork=$(echo "$PR_DATA" | jq -r '.head.repo.fork')" >> $GITHUB_OUTPUT + - name: Checkout code uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: + repository: ${{ github.event.issue.pull_request && steps.pr-info.outputs.is_fork == 'true' && format('{0}/{1}', steps.pr-info.outputs.pr_head_owner, steps.pr-info.outputs.pr_head_repo) || github.event.pull_request.head.repo.full_name || github.repository }} + ref: ${{ github.event.issue.pull_request && steps.pr-info.outputs.pr_head_ref || github.event.pull_request.head.ref || github.ref }} fetch-depth: 0 - name: Copy Claude config to home directory @@ -51,6 +66,7 @@ runs: env: GH_TOKEN: ${{ github.token }} PR_NUMBER: "${{ github.event.issue.number || github.event.pull_request.number }}" + GH_REPO: ${{ github.repository }} run: ${GITHUB_ACTION_PATH}/scripts/diff.sh - name: Hide Previous Reviews