Skip to content

Commit

Permalink
workflow: try to get pull-requests branches from fork (informatici#2073)
Browse files Browse the repository at this point in the history
* Try to get pull-requests branches from fork

* Fix history commit depth
  • Loading branch information
mwithi authored Oct 28, 2024
1 parent 65636d0 commit b24196c
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit b24196c

Please sign in to comment.