diff --git a/dist/cache-save/index.js b/dist/cache-save/index.js index 49820c5d..fd680b98 100644 --- a/dist/cache-save/index.js +++ b/dist/cache-save/index.js @@ -92709,6 +92709,10 @@ function getNodeVersionFromFile(versionFilePath) { catch { core.info('Node version file is not JSON file'); } + const actionRuntime = contents.match(/^runs\s*:\s*$(?:\r?\n(?:[ \t]+[^\r\n]*|[ \t]*))*?\r?\n[ \t]+using:\s*['"]?node(?\d+)['"]?\s*(?:#.*)?$/m); + if (actionRuntime?.groups?.version) { + return actionRuntime.groups.version; + } const found = contents.match(/^(?:node(js)?\s+)?v?(?[^\s]+)$/m); return found?.groups?.version ?? contents.trim(); } diff --git a/dist/setup/index.js b/dist/setup/index.js index 105c3a9c..8307c1d0 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -98103,6 +98103,10 @@ function getNodeVersionFromFile(versionFilePath) { catch { core_info('Node version file is not JSON file'); } + const actionRuntime = contents.match(/^runs\s*:\s*$(?:\r?\n(?:[ \t]+[^\r\n]*|[ \t]*))*?\r?\n[ \t]+using:\s*['"]?node(?\d+)['"]?\s*(?:#.*)?$/m); + if (actionRuntime?.groups?.version) { + return actionRuntime.groups.version; + } const found = contents.match(/^(?:node(js)?\s+)?v?(?[^\s]+)$/m); return found?.groups?.version ?? contents.trim(); } diff --git a/src/util.ts b/src/util.ts index 1f5234e8..d9816fd5 100644 --- a/src/util.ts +++ b/src/util.ts @@ -68,11 +68,8 @@ export function getNodeVersionFromFile(versionFilePath: string): string | null { core.info('Node version file is not JSON file'); } - const runsSection = contents.match( - /^runs\s*:\s*$(?[\s\S]*?)(?=^[^\s].*?:|\s*$)/m - )?.groups?.contents; - const actionRuntime = runsSection?.match( - /^\s+using:\s*['"]?node(?\d+)['"]?\s*(?:#.*)?$/m + const actionRuntime = contents.match( + /^runs\s*:\s*$(?:\r?\n(?:[ \t]+[^\r\n]*|[ \t]*))*?\r?\n[ \t]+using:\s*['"]?node(?\d+)['"]?\s*(?:#.*)?$/m ); if (actionRuntime?.groups?.version) { return actionRuntime.groups.version;