From 4d84260aaf8993f660436fe4c74ab7e7fdb42ebb Mon Sep 17 00:00:00 2001 From: Gregor Olenik Date: Fri, 20 Dec 2024 12:58:50 +0100 Subject: [PATCH] check via git if remote exists --- .github/workflows/build_adapter.yaml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_adapter.yaml b/.github/workflows/build_adapter.yaml index e0ffafdb4..c81953ee2 100644 --- a/.github/workflows/build_adapter.yaml +++ b/.github/workflows/build_adapter.yaml @@ -33,12 +33,20 @@ jobs: CXX: g++ runs-on: ubuntu-24.04 steps: + - name: Select branch to checkout + run: | + if [[ $(git ls-remote --heads https://github.com/exasim-project/FoamAdapter ${{ github.head_ref }}) ]] + then + echo checkout=${{ env.branch }} >> $GITHUB_ENV + else + echo checkout=main >> $GITHUB_ENV + fi - name: Checkout FoamAdapter uses: actions/checkout@v4 with: repository: exasim-project/FoamAdapter - ref: '${{ github.head_ref }}' + ref: '${{ env.branch }}' - name: Checkout NeoFOAM submodule uses: actions/checkout@v4