Skip to content

Commit

Permalink
Checkout correct git commit for pull requests on Github Actions CI
Browse files Browse the repository at this point in the history
By default git commit for pull requests on Github Actions CI is the fake
merge commit, not the pushed one. So checkout the correct pushed (HEAD)
commit.
  • Loading branch information
pali committed Jul 23, 2023
1 parent 8883425 commit 9a837e7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,16 @@ jobs:
fail-fast: false
matrix: ${{ fromJson(needs.build-matrix.outputs.matrix) }}
steps:
- name: Checkout git commit ${{ github.sha }}
- name: Checkout git commit ${{ github.sha }} (not pull request)
if: github.event_name != 'pull_request'
uses: actions/checkout@v3
with:
ref: ${{ github.sha }}
- name: Checkout git commit ${{ github.event.pull_request.head.sha }} (pull request)
if: github.event_name == 'pull_request'
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup cpan sources cache
uses: actions/cache@v3
with:
Expand Down

0 comments on commit 9a837e7

Please sign in to comment.