Skip to content

Commit b35ab8e

Browse files
committed
Use GitHub ref to get PR head
The pull request head ref name is local to its originating repository. For pull requests from forks, that ref is unlikely to exist. GitHub has special magic refs (refs/pull/<number>/<head|merge>) that can be used to reference the pull request from the destination repository's perspective. Note that the merge magic ref is not instance and is slightly quirky. Here, we're using the head ref which is less quirky.
1 parent 785e7de commit b35ab8e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

.github/workflows/update-api-reports.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
uses: actions/checkout@main
2929
with:
3030
# checkout HEAD commit instead of merge commit
31-
ref: ${{ github.event.pull_request.head.ref }}
31+
ref: refs/pull/${{ github.event.pull_request.number }}/head
3232
token: ${{ github.token }}
3333
- name: Set up node (20)
3434
uses: actions/setup-node@v4

0 commit comments

Comments
 (0)