Skip to content

Commit be3e4f6

Browse files
committed
Incorporate reviewer feedback.
1 parent fc45baf commit be3e4f6

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed

dist/main/index.js

Lines changed: 6 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/features/check-for-updates.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export async function checkForUpdates(
1414
) {
1515
const recommendedJDK = javaVersion === '17' ? '17' : '20'
1616
core.notice(
17-
`A new GraalVM release is available! Please consider upgrading to GraalVM for JDK ${recommendedJDK}. Release notes: https://www.graalvm.org/release-notes/JDK_${recommendedJDK}/`
17+
`A new GraalVM release is available! Please consider upgrading to GraalVM for JDK ${recommendedJDK}. Instructions: https://github.com/graalvm/setup-graalvm#migrating-from-graalvm-223-or-earlier-to-the-new-graalvm-for-jdk-17-and-later`
1818
)
1919
return
2020
}

src/graalvm.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
import {downloadGraalVMEELegacy} from './gds'
1010
import {downloadTool} from '@actions/tool-cache'
1111
import {basename} from 'path'
12-
import {gt} from 'semver'
12+
import {gt as semverGt, valid as semverValid} from 'semver'
1313

1414
const GRAALVM_DL_BASE = 'https://download.oracle.com/graalvm'
1515
const GRAALVM_CE_DL_BASE = `https://github.com/graalvm/${c.GRAALVM_RELEASES_REPO}/releases/download`
@@ -70,7 +70,10 @@ export async function findLatestGraalVMJDKCEJavaVersion(
7070
const versionNumberStartIndex = `refs/tags/${GRAALVM_JDK_TAG_PREFIX}`.length
7171
for (const matchingRef of matchingRefs) {
7272
const currentVersion = matchingRef.ref.substring(versionNumberStartIndex)
73-
if (gt(currentVersion, highestVersion)) {
73+
if (
74+
semverValid(currentVersion) &&
75+
semverGt(currentVersion, highestVersion)
76+
) {
7477
highestVersion = currentVersion
7578
}
7679
}

src/main.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as c from './constants'
22
import * as core from '@actions/core'
33
import * as graalvm from './graalvm'
4+
import {gte as semverGte, valid as semverValid} from 'semver'
45
import {isFeatureAvailable as isCacheAvailable} from '@actions/cache'
56
import {join} from 'path'
67
import {restore} from './features/cache'
@@ -69,7 +70,10 @@ async function run(): Promise<void> {
6970
} else {
7071
switch (graalvmVersion) {
7172
case c.VERSION_LATEST:
72-
if (javaVersion.startsWith('17') || javaVersion.startsWith('20')) {
73+
if (
74+
javaVersion.startsWith('17') ||
75+
(semverValid(javaVersion) && semverGte(javaVersion, '20'))
76+
) {
7377
core.info(
7478
`This build is using the new Oracle GraalVM. To select a specific distribution, use the 'distribution' option (see https://github.com/graalvm/setup-graalvm/tree/main#options).`
7579
)

0 commit comments

Comments
 (0)