Skip to content

Commit

Permalink
Use GitHub ref to get PR head
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jsoref committed May 31, 2024
1 parent 785e7de commit b35ab8e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/update-api-reports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
uses: actions/checkout@main
with:
# checkout HEAD commit instead of merge commit
ref: ${{ github.event.pull_request.head.ref }}
ref: refs/pull/${{ github.event.pull_request.number }}/head
token: ${{ github.token }}
- name: Set up node (20)
uses: actions/setup-node@v4
Expand Down

0 comments on commit b35ab8e

Please sign in to comment.