Skip to content

Commit

Permalink
Fixups from review feedback - simply bash env var check, and explain …
Browse files Browse the repository at this point in the history
…that major-java-version is a possible alternative
  • Loading branch information
rtyley committed Jan 10, 2025
1 parent 37b3eaf commit f8b37d4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ runs:
env:
MAJOR_JAVA_VERSION: ${{ inputs.major-java-version }}
run: |
if [ ${MAJOR_JAVA_VERSION:-} ]; then
if [ ${MAJOR_JAVA_VERSION} ]; then
echo "Reading Java version from the 'major-java-version' input property, rather than .tool-versions"
else
if [ ! -f .tool-versions ]; then
echo "::error title=Missing .tool-versions file::setup-scala requires an asdf-format .tool-versions file to establish the Java version for the build."
echo "::error title=Missing .tool-versions file::setup-scala prefers an asdf-format .tool-versions file to establish the Java version for the build - a standard file that is understood by many different tools. Failing this, specify the 'major-java-version' parameter."
exit 1
fi
MAJOR_JAVA_VERSION=$( grep -Eo 'java [[:alnum:]-]+-[[:digit:]]+' .tool-versions | rev | cut -d'-' -f1 | rev )
Expand Down

0 comments on commit f8b37d4

Please sign in to comment.