From eb6153c5aa301ce6339de248d74b95d584b0a732 Mon Sep 17 00:00:00 2001 From: Fabian Koller Date: Sun, 31 Jan 2021 12:00:41 +0100 Subject: [PATCH] Change CI ref from merge to head At this time in the CI, merge is not accessible from tree https://github.community/t/github-sha-but-how-to-get-the-latest-commit-reference-on-a-branch/17160 --- .github/workflows/ansible.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ansible.yml b/.github/workflows/ansible.yml index fd965e760..a27ce103c 100644 --- a/.github/workflows/ansible.yml +++ b/.github/workflows/ansible.yml @@ -7,13 +7,20 @@ jobs: # https://molecule.readthedocs.io/en/latest/ci.html#github-actions test: runs-on: ubuntu-latest - # https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions#github-context - if: github.event_name == 'pull_request' || (github.event_name == 'push' && contains(github.ref, 'refs/heads/')) steps: - name: Check out the codebase uses: actions/checkout@v2 + if: github.event_name != 'pull_request' with: path: "${{ github.repository }}" + - name: Check out the codebase + uses: actions/checkout@v2 + if: github.event_name == 'pull_request' + with: + # merge commit is not available from tree at this point in time + # https://github.com/actions/checkout#checkout-pull-request-head-commit-instead-of-merge-commit + ref: "${{ github.event.pull_request.head.sha }}" + path: "${{ github.repository }}" - name: Set up Python uses: actions/setup-python@v2 - name: Set up Docker