From b24196c53005432ba03f4aeb9d0f904c78580a19 Mon Sep 17 00:00:00 2001 From: Alessandro Domanico Date: Mon, 28 Oct 2024 20:29:16 +0100 Subject: [PATCH] workflow: try to get pull-requests branches from fork (#2073) * Try to get pull-requests branches from fork * Fix history commit depth --- .github/workflows/maven.yml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 29a475fc1f..d71a136bd4 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -15,9 +15,11 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Determine PR source branch - id: extract_branch - run: echo "BRANCH_NAME=${GITHUB_HEAD_REF:-develop}" >> $GITHUB_ENV + - name: Determine PR source branch and fork repository + id: vars + run: | + echo "BRANCH_NAME=${GITHUB_HEAD_REF:-develop}" >> $GITHUB_ENV + echo "FORK_REPO=${GITHUB_HEAD_REPOSITORY:-informatici/openhospital-core}" >> $GITHUB_ENV - name: Set up JDK 17 uses: actions/setup-java@v4 @@ -28,14 +30,16 @@ jobs: - name: Checkout core run: | - git clone --depth=50 https://github.com/informatici/openhospital-core.git openhospital-core - cd openhospital-core - git fetch origin ${{ env.BRANCH_NAME }} || git fetch origin develop - git checkout ${{ env.BRANCH_NAME }} || git checkout develop - cd .. + git clone --depth=1 --no-single-branch https://github.com/${{ env.FORK_REPO }}.git openhospital-core + pushd openhospital-core + git checkout -B ${{ env.BRANCH_NAME }} origin/${{ env.BRANCH_NAME }} || git checkout develop + popd - name: Install core - run: cd openhospital-core && mvn install -DskipTests=true && cd .. + run: | + pushd openhospital-core + mvn install -DskipTests=true + popd - name: Build GUI with Maven run: mvn -B package --file pom.xml