File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed
Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -194,10 +194,31 @@ jobs:
194194 core.setOutput('approved', 'false');
195195 }
196196
197- - name : Checkout code
197+ - name : Get PR branch
198+ if : steps.check-maintainer.outputs.approved == 'true'
199+ id : pr-branch
200+ run : |
201+ # Get the PR number from the issue number (for issue_comment events on PRs)
202+ PR_NUMBER="${{ github.event.issue.number }}"
203+ echo "PR number: $PR_NUMBER"
204+
205+ # Get PR details to find the head ref
206+ PR_DATA=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
207+ "https://api.github.com/repos/${{ github.repository }}/pulls/$PR_NUMBER")
208+
209+ HEAD_REF=$(echo "$PR_DATA" | jq -r '.head.ref')
210+ HEAD_SHA=$(echo "$PR_DATA" | jq -r '.head.sha')
211+
212+ echo "head_ref=$HEAD_REF" >> $GITHUB_OUTPUT
213+ echo "head_sha=$HEAD_SHA" >> $GITHUB_OUTPUT
214+ echo "PR branch: $HEAD_REF"
215+ echo "PR SHA: $HEAD_SHA"
216+
217+ - name : Checkout PR code
198218 if : steps.check-maintainer.outputs.approved == 'true'
199219 uses : actions/checkout@v4
200220 with :
221+ ref : ${{ steps.pr-branch.outputs.head_sha }}
201222 fetch-depth : 0
202223
203224 - name : Setup pnpm
You can’t perform that action at this time.
0 commit comments