From 9a837e7c4938491d195af3661258df5e9d5c1898 Mon Sep 17 00:00:00 2001 From: Pali Date: Sun, 23 Jul 2023 12:24:02 +0200 Subject: [PATCH] Checkout correct git commit for pull requests on Github Actions CI 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. --- .github/workflows/ci.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 94a7429c..b0808c03 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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: