From 9811a458176b08ff261117af87c10e7f6db99a2e Mon Sep 17 00:00:00 2001 From: Joao Paulo Magalhaes Date: Wed, 14 Aug 2024 10:22:14 +0100 Subject: [PATCH] ci: fix manual checkout --- .github/workflows/clang.yml | 6 +++++- .github/workflows/gcc.yml | 24 ++++++++++++++++++++---- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/.github/workflows/clang.yml b/.github/workflows/clang.yml index 000d223..6e6efa6 100644 --- a/.github/workflows/clang.yml +++ b/.github/workflows/clang.yml @@ -159,10 +159,14 @@ jobs: - name: checkout run: | set -x + echo $GITHUB_REF + echo $GITHUB_HEAD_REF + branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} # https://stackoverflow.com/questions/58033366 + echo $branch git init -q . git config --system --add safe.directory '*' # needed for running in the docker image. see https://github.com/actions/checkout/issues/1169 git remote add origin $GITHUB_SERVER_URL/$GITHUB_REPOSITORY - git fetch origin $GITHUB_HEAD_REF + git fetch origin $branch git reset --hard FETCH_HEAD git submodule update --init --recursive - run: c4core-install ${{matrix.cxx}} diff --git a/.github/workflows/gcc.yml b/.github/workflows/gcc.yml index c358bf6..2510b6e 100644 --- a/.github/workflows/gcc.yml +++ b/.github/workflows/gcc.yml @@ -53,10 +53,14 @@ jobs: - name: checkout run: | set -x + echo $GITHUB_REF + echo $GITHUB_HEAD_REF + branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} # https://stackoverflow.com/questions/58033366 + echo $branch git init -q . git config --system --add safe.directory '*' # needed for running in the docker image. see https://github.com/actions/checkout/issues/1169 git remote add origin $GITHUB_SERVER_URL/$GITHUB_REPOSITORY - git fetch origin $GITHUB_HEAD_REF + git fetch origin $branch git reset --hard FETCH_HEAD git submodule update --init --recursive - run: c4core-install ${{matrix.cxx}} @@ -105,10 +109,14 @@ jobs: - name: checkout run: | set -x + echo $GITHUB_REF + echo $GITHUB_HEAD_REF + branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} # https://stackoverflow.com/questions/58033366 + echo $branch git init -q . git config --system --add safe.directory '*' # needed for running in the docker image. see https://github.com/actions/checkout/issues/1169 git remote add origin $GITHUB_SERVER_URL/$GITHUB_REPOSITORY - git fetch origin $GITHUB_HEAD_REF + git fetch origin $branch git reset --hard FETCH_HEAD git submodule update --init --recursive - run: c4core-install ${{matrix.cxx}} @@ -185,10 +193,14 @@ jobs: - name: checkout run: | set -x + echo $GITHUB_REF + echo $GITHUB_HEAD_REF + branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} # https://stackoverflow.com/questions/58033366 + echo $branch git init -q . git config --system --add safe.directory '*' # needed for running in the docker image. see https://github.com/actions/checkout/issues/1169 git remote add origin $GITHUB_SERVER_URL/$GITHUB_REPOSITORY - git fetch origin $GITHUB_HEAD_REF + git fetch origin $branch git reset --hard FETCH_HEAD git submodule update --init --recursive - run: c4core-install ${{matrix.cxx}} @@ -293,10 +305,14 @@ jobs: - name: checkout run: | set -x + echo $GITHUB_REF + echo $GITHUB_HEAD_REF + branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} # https://stackoverflow.com/questions/58033366 + echo $branch git init -q . git config --system --add safe.directory '*' # needed for running in the docker image. see https://github.com/actions/checkout/issues/1169 git remote add origin $GITHUB_SERVER_URL/$GITHUB_REPOSITORY - git fetch origin $GITHUB_HEAD_REF + git fetch origin $branch git reset --hard FETCH_HEAD git submodule update --init --recursive - name: install gcc-arm-linux-gnueabihf