Skip to content

Commit

Permalink
ci(setup-maven): try to auto-detect git ref
Browse files Browse the repository at this point in the history
It's not so easy to determine the right git ref for different scenarios like PR, etc. Unless explicitly given a ref, try to autodetect the right one to go with.
  • Loading branch information
poikilotherm committed Sep 17, 2024
1 parent f1b1683 commit c3760c3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 12 additions & 1 deletion .github/actions/setup-maven/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ inputs:
git-reference:
description: 'The git reference (branch/tag) to check out'
required: true
default: 'develop'
default: 'null'
pom-paths:
description: "List of paths to Maven POM(s) for cache dependency setup"
required: false
Expand All @@ -14,9 +14,20 @@ runs:
using: composite
steps:
- name: Checkout repository
if: ${{ inputs.git-reference != 'null' }}
uses: actions/checkout@v4
with:
ref: ${{ inputs.git-reference }}
- name: Checkout repository
if: ${{ inputs.git-reference == 'null' && github.event_name == 'pull_request' }}
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Checkout repository
if: ${{ inputs.git-reference == 'null' && github.event_name != 'pull_request' }}
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Determine Java version by reading the Maven property
shell: bash
run: |
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/container_app_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ jobs:
# TODO: change to upstream location in final PR
uses: gdcc/wip-dataverse-base-image/.github/actions/setup-maven@10478-version-base-img
with:
git-reference: ${{ github.ref_name }}
pom-paths: |
pom.xml
modules/container-configbaker/pom.xml
Expand Down Expand Up @@ -117,7 +116,6 @@ jobs:
# TODO: change to upstream location in final PR
uses: gdcc/wip-dataverse-base-image/.github/actions/setup-maven@10478-version-base-img
with:
git-reference: ${{ github.ref_name }}
pom-paths: |
pom.xml
modules/container-configbaker/pom.xml
Expand Down

0 comments on commit c3760c3

Please sign in to comment.