From 940fa288f64665f37f5373e0370e39ba072694fa Mon Sep 17 00:00:00 2001 From: Adrien RICCIARDI Date: Sun, 23 Jan 2022 12:28:08 +0100 Subject: [PATCH] Fixed GitHub Actions CI build for pull requests. (#521) Signed-off-by: RICCIARDI-Adrien --- .github/workflows/build.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index b73d622..384b8a5 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -9,7 +9,6 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} TRAVIS_BUILD_NUMBER: ${{ github.run_number }} - BRANCH: ${{ github.ref_name }} VERSION: continuous steps: - name: Configure build machine @@ -21,7 +20,10 @@ jobs: - name: Checkout sources run: | # Can't use actions/checkout@v2 action here because Ubuntu 16.04 git version is too old, so the action downloads an archive instead of a git repository, and this prevents linuxdeployqt from finding the commit it is built from - git clone --depth=1 https://github.com/${{ github.repository }} --branch=${{ github.ref_name }} . + # Retrieve the correct branch name according to the build event (push or pull_request) + if [ -z "${{ github.head_ref }}" ]; then BRANCH=${{ github.ref_name }}; else BRANCH=${{ github.head_ref }}; fi + echo "Cloning from branch $BRANCH..." + git clone --depth=1 https://github.com/${{ github.repository }} --branch=$BRANCH . - name: Environment tests run: ./tests/tests-environment.sh - name: CI tests