Compare commits

..
13 changed files with 464 additions and 303 deletions
+26
View File
@@ -151,6 +151,32 @@ jobs:
run: __tests__/verify-node.sh "${{ matrix.node-version }}"
shell: bash
allow-alpha:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [27, 27.0.0]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Node with allow-alpha
uses: ./
with:
node-version: ${{ matrix.node-version }}
allow-alpha: true
- name: Verify an alpha is installed
run: |
nodeVersion=$(node --version)
if [[ "$nodeVersion" != *-alpha* ]]; then
echo "Expected a Node.js alpha but found $nodeVersion. Move this job to the next alpha release line."
exit 1
fi
shell: bash
- name: Verify node and npm
run: __tests__/verify-node.sh "${{ matrix.node-version }}"
shell: bash
version-file:
runs-on: ${{ matrix.os }}
strategy:
+1 -1
View File
@@ -1,6 +1,6 @@
---
name: undici
version: 6.29.1
version: 6.29.0
type: npm
summary: An HTTP/1.1 client, written from scratch for Node.js
homepage: https://undici.nodejs.org
+5
View File
@@ -59,6 +59,10 @@ See [action.yml](action.yml)
# Default: false
check-latest: false
# Allow alpha releases when no stable release matches the version spec.
# Default: false
allow-alpha: false
# Target architecture for Node to use. Examples: x86, x64. Will use system architecture by default.
# Default: ''. The action use system architecture by default
architecture: ''
@@ -255,6 +259,7 @@ If the runner is not able to access github.com, any Nodejs versions requested du
## Advanced usage
- [Check latest version](docs/advanced-usage.md#check-latest-version)
- [Allow alpha releases](docs/advanced-usage.md#allow-alpha-releases)
- [Using a node version file](docs/advanced-usage.md#node-version-file)
- [Using different architectures](docs/advanced-usage.md#architecture)
- [Using v8 canary versions](docs/advanced-usage.md#v8-canary-versions)
+217
View File
@@ -479,6 +479,69 @@ describe('setup-node', () => {
expect(addPathSpy).toHaveBeenCalledWith(expPath);
});
it('sends GitHub token to GitHub manifest and release downloads when mirror and mirror-token are set', async () => {
os.platform = 'linux';
os.arch = 'x64';
const versionSpec = '12.16.2';
inputs['node-version'] = versionSpec;
inputs['token'] = 'github-secret-token';
inputs['mirror'] = 'https://my_mirror_url';
inputs['mirror-token'] = 'mirror-secret-token';
findSpy.mockImplementation(() => '');
dlSpy.mockImplementation(async () => '/some/temp/path');
const toolPath = path.normalize('/cache/node/12.16.2/x64');
exSpy.mockImplementation(async () => '/some/other/temp/path');
cacheSpy.mockImplementation(async () => toolPath);
await main.run();
expect(getManifestSpy).toHaveBeenCalledWith(
'actions',
'node-versions',
'token github-secret-token',
'main'
);
expect(dlSpy).toHaveBeenCalledWith(
'https://github.com/actions/node-versions/releases/download/12.16.2-20200507.95/node-12.16.2-linux-x64.tar.gz',
undefined,
'token github-secret-token'
);
});
it('sends GitHub token to manifest and mirror-token to mirror when falling back to mirror', async () => {
os.platform = 'linux';
os.arch = 'x64';
const versionSpec = '11.15.0';
const mirror = 'https://my_mirror_url';
inputs['node-version'] = versionSpec;
inputs['token'] = 'github-secret-token';
inputs['mirror'] = mirror;
inputs['mirror-token'] = 'mirror-secret-token';
findSpy.mockImplementation(() => '');
dlSpy.mockImplementation(async () => '/some/temp/path');
const toolPath = path.normalize('/cache/node/11.15.0/x64');
exSpy.mockImplementation(async () => '/some/other/temp/path');
cacheSpy.mockImplementation(async () => toolPath);
await main.run();
expect(getManifestSpy).toHaveBeenCalledWith(
'actions',
'node-versions',
'token github-secret-token',
'main'
);
expect(dlSpy).toHaveBeenCalledWith(
`${mirror}/dist/v11.15.0/node-v11.15.0-linux-x64.tar.gz`,
undefined,
'mirror-secret-token'
);
});
it('falls back to a version from node dist', async () => {
os.platform = 'linux';
os.arch = 'x64';
@@ -792,6 +855,160 @@ describe('setup-node', () => {
}, 10000);
});
describe('allow-alpha', () => {
const olderAlpha = '27.0.0-alpha.0.0.9';
const newestAlpha = '27.0.0-alpha.0.0.10';
const files = ['linux-x64'];
let releases: INodeVersion[];
function expectInstalled(version: string) {
const toolPath = path.normalize(`/cache/node/${version}/${os.arch}`);
cacheSpy.mockImplementation(async () => toolPath);
getExecOutputSpy.mockImplementation(async () => ({
stdout: `v${version}`,
stderr: '',
exitCode: 0
}));
return toolPath;
}
beforeEach(() => {
os.platform = 'linux';
os.arch = 'x64';
inputs['allow-alpha'] = 'true';
inputs['node-version'] = '27';
releases = [
{version: `v${olderAlpha}`, files},
{version: `v${newestAlpha}`, files},
{version: 'v28.0.0-alpha.0.0.0', files},
{version: 'v26.1.0', files}
];
getJsonSpy.mockImplementation(async () => ({result: releases}));
findSpy.mockReturnValue('');
dlSpy.mockImplementation(async () => '/some/temp/path');
exSpy.mockImplementation(async () => '/some/extracted/path');
});
it.each([
'27',
'27.x',
'27.0',
'27.0.0',
'^27.0.0',
'~27.0.0',
'>=27.0.0 <28.0.0'
])('selects the newest matching alpha for %s', async versionSpec => {
inputs['node-version'] = versionSpec;
expectInstalled(newestAlpha);
await main.run();
expect(setFailedSpy).not.toHaveBeenCalled();
expect(dlSpy).toHaveBeenCalledWith(
`https://nodejs.org/dist/v${newestAlpha}/node-v${newestAlpha}-linux-x64.tar.gz`,
undefined,
undefined
);
});
it.each(['27', '27.0.0'])(
'prefers a stable release for %s over a newer alpha',
async versionSpec => {
inputs['node-version'] = versionSpec;
releases.push({version: 'v27.0.0', files});
expectInstalled('27.0.0');
await main.run();
expect(setFailedSpy).not.toHaveBeenCalled();
expect(cacheSpy).toHaveBeenCalledWith(
'/some/extracted/path',
'node',
'27.0.0',
'x64'
);
}
);
it.each([undefined, 'false'])(
'does not select an alpha and suggests the input when allow-alpha is %s',
async allowAlpha => {
inputs['allow-alpha'] = allowAlpha;
await main.run();
expect(setFailedSpy).toHaveBeenCalledWith(
"Unable to find Node version '27' for platform linux and architecture x64. A matching alpha release is available; set 'allow-alpha: true' to use it."
);
expect(dlSpy).not.toHaveBeenCalled();
}
);
it.each(['latest', 'current', 'node'])(
'installs the newest stable release for %s',
async versionSpec => {
inputs['node-version'] = versionSpec;
expectInstalled('26.1.0');
await main.run();
expect(setFailedSpy).not.toHaveBeenCalled();
expect(cacheSpy).toHaveBeenCalledWith(
'/some/extracted/path',
'node',
'26.1.0',
'x64'
);
}
);
it('does not suggest allow-alpha when no alpha matches', async () => {
inputs['allow-alpha'] = 'false';
inputs['node-version'] = '29';
await main.run();
expect(setFailedSpy).toHaveBeenCalledWith(
"Unable to find Node version '29' for platform linux and architecture x64."
);
});
it('respects an explicit prerelease lower bound', async () => {
inputs['node-version'] = '>=27.0.0-alpha.0.0.99';
await main.run();
expect(setFailedSpy).toHaveBeenCalledWith(
"Unable to find Node version '>=27.0.0-alpha.0.0.99' for platform linux and architecture x64."
);
expect(dlSpy).not.toHaveBeenCalled();
});
it('reuses a cached alpha instead of downloading it again', async () => {
const toolPath = expectInstalled(newestAlpha);
findSpy.mockImplementation((_tool, version) =>
version === `v${newestAlpha}` ? toolPath : ''
);
await main.run();
expect(setFailedSpy).not.toHaveBeenCalled();
expect(dlSpy).not.toHaveBeenCalled();
expect(addPathSpy).toHaveBeenCalledWith(path.join(toolPath, 'bin'));
});
it('downloads a newer alpha when only an older alpha is cached', async () => {
findSpy.mockImplementation((_tool, version) =>
version === `v${olderAlpha}` ? `/cache/node/${olderAlpha}/x64` : ''
);
expectInstalled(newestAlpha);
await main.run();
expect(setFailedSpy).not.toHaveBeenCalled();
expect(cacheSpy).toHaveBeenCalledWith(
'/some/extracted/path',
'node',
newestAlpha,
'x64'
);
});
});
describe('LTS version', () => {
useRetryTimers();
+3
View File
@@ -11,6 +11,9 @@ inputs:
check-latest:
description: 'Set this option if you want the action to check for the latest available version that satisfies the version spec.'
default: false
allow-alpha:
description: 'Allow alpha releases when no stable release matches the version spec.'
default: false
registry-url:
description: 'Optional registry to set up for auth. Will set the registry in a project level .npmrc and .yarnrc file, and set up auth to read in from env.NODE_AUTH_TOKEN.'
scope:
+30 -134
View File
@@ -14008,7 +14008,7 @@ function defaultFactory (origin, opts) {
}
class Agent extends DispatcherBase {
constructor ({ factory = defaultFactory, maxRedirections = 0, connect, tls, ...options } = {}) {
constructor ({ factory = defaultFactory, maxRedirections = 0, connect, ...options } = {}) {
if (typeof factory !== 'function') {
throw new InvalidArgumentError('factory must be a function.')
}
@@ -14027,15 +14027,11 @@ class Agent extends DispatcherBase {
connect = { ...connect }
}
if (tls && typeof tls !== 'function') {
tls = { ...tls }
}
this[kInterceptors] = options.interceptors?.Agent && Array.isArray(options.interceptors.Agent)
? options.interceptors.Agent
: [createRedirectInterceptor({ maxRedirections })]
this[kOptions] = { ...util.deepClone(options), connect, tls }
this[kOptions] = { ...util.deepClone(options), connect }
this[kOptions].interceptors = options.interceptors
? { ...options.interceptors }
: undefined
@@ -15068,6 +15064,8 @@ async function connectH1 (client, socket) {
socket[kParser] = new Parser(client, socket, llhttpInstance)
addListener(socket, 'error', function (err) {
assert(err.code !== 'ERR_TLS_CERT_ALTNAME_INVALID')
const parser = this[kParser]
// On Mac OS, we get an ECONNRESET even if there is a full body to be forwarded
@@ -15997,6 +15995,8 @@ async function connectH2 (client, socket) {
socket[kHTTP2Session] = session
util.addListener(socket, 'error', function (err) {
assert(err.code !== 'ERR_TLS_CERT_ALTNAME_INVALID')
this[kError] = err
this[kClient][kOnError](err)
@@ -16070,6 +16070,8 @@ function resumeH2 (client) {
}
function onHttp2SessionError (err) {
assert(err.code !== 'ERR_TLS_CERT_ALTNAME_INVALID')
this[kSocket][kError] = err
this[kClient][kOnError](err)
}
@@ -16767,10 +16769,9 @@ class Client extends DispatcherBase {
// h2
maxConcurrentStreams,
allowH2,
webSocket,
eventSource
webSocket
} = {}) {
super({ webSocket, eventSource })
super({ webSocket })
if (keepAlive !== undefined) {
throw new InvalidArgumentError('unsupported keepAlive, use pipelining=0 instead')
@@ -17291,7 +17292,6 @@ module.exports = Client
const buffer = __nccwpck_require__(4573)
const Dispatcher = __nccwpck_require__(883)
const {
ClientDestroyedError,
@@ -17304,7 +17304,6 @@ const kOnDestroyed = Symbol('onDestroyed')
const kOnClosed = Symbol('onClosed')
const kInterceptedDispatch = Symbol('Intercepted Dispatch')
const kWebSocketOptions = Symbol('webSocketOptions')
const kEventSourceOptions = Symbol('eventSourceOptions')
class DispatcherBase extends Dispatcher {
constructor (opts) {
@@ -17315,7 +17314,6 @@ class DispatcherBase extends Dispatcher {
this[kClosed] = false
this[kOnClosed] = []
this[kWebSocketOptions] = opts?.webSocket ?? {}
this[kEventSourceOptions] = opts?.eventSource ?? {}
}
get webSocketOptions () {
@@ -17325,12 +17323,6 @@ class DispatcherBase extends Dispatcher {
}
}
get eventSourceOptions () {
return {
maxEventSize: this[kEventSourceOptions].maxEventSize ?? buffer.kStringMaxLength
}
}
get destroyed () {
return this[kDestroyed]
}
@@ -23689,7 +23681,6 @@ module.exports = {
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
const buffer = __nccwpck_require__(4573)
const { Transform } = __nccwpck_require__(7075)
const { isASCIINumber, isValidLastEventId } = __nccwpck_require__(4811)
@@ -23714,19 +23705,11 @@ const COLON = 0x3A
*/
const SPACE = 0x20
const defaultMaxEventSize = buffer.kStringMaxLength
const DATA = Buffer.from('data')
const EVENT = Buffer.from('event')
const ID = Buffer.from('id')
const RETRY = Buffer.from('retry')
// Each data field creates a string node, and each unconsumed input chunk keeps
// a Buffer wrapper. The absolute ceiling protects the large default byte limit.
const minParserItems = 1024
const maxParserItems = 131072
const bytesPerParserItem = 128
function isASCIINumberBytes (buffer, start) {
if (start >= buffer.length) {
return false
@@ -23765,12 +23748,6 @@ function isFieldName (line, length, field) {
return true
}
function createMaxEventSizeExceededError () {
const error = new Error('EventSource message size exceeded')
error.aborted = false
return error
}
/**
* @typedef {object} EventSourceStreamEvent
* @type {object}
@@ -23819,13 +23796,6 @@ class EventSourceStream extends Transform {
pos = 0
lineChunkIndex = 0
linePos = 0
lineLength = 0
eventSize = 0
eventFieldSizes = { data: 0, event: 0, id: 0, retry: 0 }
dataLineCount = 0
maxEventSize
maxDataLines
maxBufferedChunks
event = {
data: undefined,
@@ -23836,7 +23806,6 @@ class EventSourceStream extends Transform {
/**
* @param {object} options
* @param {number} [options.maxEventSize]
* @param {eventSourceSettings} options.eventSourceSettings
* @param {Function} [options.push]
*/
@@ -23848,12 +23817,6 @@ class EventSourceStream extends Transform {
super(options)
this.state = options.eventSourceSettings || {}
this.maxEventSize = options.maxEventSize ?? defaultMaxEventSize
const parserItemLimit = this.maxEventSize > 0
? Math.min(maxParserItems, Math.max(minParserItems, Math.floor(this.maxEventSize / bytesPerParserItem)))
: 0
this.maxDataLines = parserItemLimit
this.maxBufferedChunks = parserItemLimit
if (options.push) {
this.push = options.push
}
@@ -23871,14 +23834,6 @@ class EventSourceStream extends Transform {
return
}
// A leading line ending can immediately release the currently buffered
// line, even when it uses the final allowed chunk slot.
if (this.maxEventSize > 0 &&
this.chunks.length >= this.maxBufferedChunks &&
chunk[0] !== LF && chunk[0] !== CR) {
callback(createMaxEventSizeExceededError())
return
}
this.chunks.push(chunk)
// Strip leading byte-order-mark if we opened the stream and started
@@ -23957,12 +23912,7 @@ class EventSourceStream extends Transform {
// In any case, we can process the line as we reached an
// end-of-line character
try {
this.parseLine(this.readLine(), this.event)
} catch (error) {
callback(error)
return
}
this.parseLine(this.readLine(), this.event)
this.consumeCurrentByte()
// A line was processed and this could be the end of the event. We need
// to check if the next line is empty to determine if the event is
@@ -23971,28 +23921,15 @@ class EventSourceStream extends Transform {
continue
}
// readLine() is only called after CR or LF. Reject an unfinished line
// before it can retain an unbounded number of decoded chunks. The seven
// extra bytes allow the longest field prefix ("event: " or "retry: ").
if (this.maxEventSize > 0 && ++this.lineLength > this.maxEventSize + 7) {
callback(createMaxEventSizeExceededError())
return
}
this.advanceCursor()
}
callback()
}
_destroy (error, callback) {
this.chunks.length = 0
this.clearEvent()
super._destroy(error, callback)
}
/**
* @param {Buffer} line
* @param {EventSourceStreamEvent} event
* @param {EventStreamEvent} event
*/
parseLine (line, event) {
// If the line is empty (a blank line)
@@ -24026,13 +23963,6 @@ class EventSourceStream extends Transform {
}
if (isFieldName(line, fieldLength, DATA)) {
if (this.maxEventSize > 0 && this.dataLineCount >= this.maxDataLines) {
throw createMaxEventSizeExceededError()
}
const valueBytes = line.length - valueStart
const dataSize = this.eventFieldSizes.data + (event.data === undefined ? 0 : 1) + valueBytes
this.setEventFieldSize('data', dataSize)
const value = line.toString('utf8', valueStart)
if (event.data === undefined) {
@@ -24040,13 +23970,11 @@ class EventSourceStream extends Transform {
} else {
event.data += `\n${value}`
}
this.dataLineCount++
return
}
if (isFieldName(line, fieldLength, RETRY)) {
if (isASCIINumberBytes(line, valueStart)) {
this.setEventFieldSize('retry', line.length - valueStart)
event.retry = line.toString('utf8', valueStart)
}
return
@@ -24054,29 +23982,20 @@ class EventSourceStream extends Transform {
if (isFieldName(line, fieldLength, ID)) {
if (isValidLastEventIdBytes(line, valueStart)) {
this.setEventFieldSize('id', line.length - valueStart)
event.id = line.toString('utf8', valueStart)
}
return
}
if (isFieldName(line, fieldLength, EVENT)) {
if (valueStart < line.length) {
this.setEventFieldSize('event', line.length - valueStart)
event.event = line.toString('utf8', valueStart)
const value = line.toString('utf8', valueStart)
if (value.length > 0) {
event.event = value
}
}
}
setEventFieldSize (field, size) {
const eventSize = this.eventSize - this.eventFieldSizes[field] + size
if (this.maxEventSize > 0 && eventSize > this.maxEventSize) {
throw createMaxEventSizeExceededError()
}
this.eventSize = eventSize
this.eventFieldSizes[field] = size
}
/**
* @param {EventSourceStreamEvent} event
*/
@@ -24107,12 +24026,6 @@ class EventSourceStream extends Transform {
this.event.event = undefined
this.event.id = undefined
this.event.retry = undefined
this.eventSize = 0
this.dataLineCount = 0
this.eventFieldSizes.data = 0
this.eventFieldSizes.event = 0
this.eventFieldSizes.id = 0
this.eventFieldSizes.retry = 0
}
hasPendingEvent () {
@@ -24148,16 +24061,14 @@ class EventSourceStream extends Transform {
syncLineStartToCursor () {
this.lineChunkIndex = this.chunkIndex
this.linePos = this.pos
this.lineLength = 0
this.dropConsumedChunks()
}
dropConsumedChunks () {
if (this.lineChunkIndex > 0) {
const consumed = this.lineChunkIndex
this.chunks.splice(0, consumed)
this.lineChunkIndex = 0
this.chunkIndex -= consumed
while (this.lineChunkIndex > 0) {
this.chunks.shift()
this.lineChunkIndex--
this.chunkIndex--
}
if (this.chunkIndex === this.chunks.length) {
@@ -24282,7 +24193,6 @@ const { isNetworkError } = __nccwpck_require__(9051)
const { delay } = __nccwpck_require__(4811)
const { kEnumerableProperty } = __nccwpck_require__(3440)
const { environmentSettingsObject } = __nccwpck_require__(3168)
const { getGlobalDispatcher } = __nccwpck_require__(2581)
let experimentalWarned = false
@@ -24564,7 +24474,6 @@ class EventSource extends EventTarget {
const eventSourceStream = new EventSourceStream({
eventSourceSettings: this.#state,
maxEventSize: this.#dispatcher.eventSourceOptions?.maxEventSize,
push: (event) => {
this.dispatchEvent(createFastMessageEvent(
event.type,
@@ -24743,8 +24652,7 @@ webidl.converters.EventSourceInitDict = webidl.dictionaryConverter([
},
{
key: 'dispatcher', // undici only
converter: webidl.converters.any,
defaultValue: () => getGlobalDispatcher()
converter: webidl.converters.any
}
])
@@ -29840,10 +29748,8 @@ async function httpNetworkFetch (
// 19. Run these steps in parallel:
// 1. Run these steps, but abort when fetchParams is canceled:
if (!fetchParams.controller.resume) {
fetchParams.controller.on('terminated', onAborted)
}
fetchParams.controller.onAborted = onAborted
fetchParams.controller.on('terminated', onAborted)
fetchParams.controller.resume = async () => {
// 1. While true
while (true) {
@@ -30012,6 +29918,8 @@ async function httpNetworkFetch (
}
location = headersList.get('location', true)
this.body = new Readable({ read: resume })
const decoders = []
const willFollow = location && request.redirect === 'follow' &&
@@ -30029,7 +29937,7 @@ async function httpNetworkFetch (
// CVE fix similar to urllib3 (GHSA-gm62-xv2j-4w53) and curl (CVE-2022-32206).
const maxContentEncodings = 5
if (codings.length > maxContentEncodings) {
this.abort(new Error(`too many content-encodings in response: ${codings.length}, maximum allowed is ${maxContentEncodings}`))
reject(new Error(`too many content-encodings in response: ${codings.length}, maximum allowed is ${maxContentEncodings}`))
return true
}
@@ -30062,8 +29970,6 @@ async function httpNetworkFetch (
}
}
this.body = new Readable({ read: resume })
const onError = this.onError.bind(this)
resolve({
@@ -30110,6 +30016,10 @@ async function httpNetworkFetch (
fetchParams.controller.off('terminated', this.abort)
}
if (fetchParams.controller.onAborted) {
fetchParams.controller.off('terminated', fetchParams.controller.onAborted)
}
fetchParams.controller.ended = true
this.body.push(null)
@@ -36584,20 +36494,6 @@ class ByteParser extends Writable {
if (isControlFrame(this.#info.opcode)) {
this.#loop = this.parseControlFrame(body)
this.#state = parserStates.INFO
// If the automatic PONG/CLOSE reply filled the socket's write buffer,
// stop parsing and resume on drain so a PING flood cannot grow the
// outbound queue without bound.
const socket = this.ws[kResponse].socket
if (this.#loop && socket.writableNeedDrain) {
this.#loop = false
socket.once('drain', () => {
if (this.destroyed) return
this.#loop = true
this.run(callback)
})
return
}
} else {
if (!this.#info.compressed) {
if (!this.writeFragments(body)) {
+81 -147
View File
@@ -14849,7 +14849,7 @@ function defaultFactory (origin, opts) {
}
class Agent extends DispatcherBase {
constructor ({ factory = defaultFactory, maxRedirections = 0, connect, tls, ...options } = {}) {
constructor ({ factory = defaultFactory, maxRedirections = 0, connect, ...options } = {}) {
if (typeof factory !== 'function') {
throw new InvalidArgumentError('factory must be a function.')
}
@@ -14868,15 +14868,11 @@ class Agent extends DispatcherBase {
connect = { ...connect }
}
if (tls && typeof tls !== 'function') {
tls = { ...tls }
}
this[kInterceptors] = options.interceptors?.Agent && Array.isArray(options.interceptors.Agent)
? options.interceptors.Agent
: [createRedirectInterceptor({ maxRedirections })]
this[kOptions] = { ...util.deepClone(options), connect, tls }
this[kOptions] = { ...util.deepClone(options), connect }
this[kOptions].interceptors = options.interceptors
? { ...options.interceptors }
: undefined
@@ -15909,6 +15905,8 @@ async function connectH1 (client, socket) {
socket[kParser] = new Parser(client, socket, llhttpInstance)
addListener(socket, 'error', function (err) {
assert(err.code !== 'ERR_TLS_CERT_ALTNAME_INVALID')
const parser = this[kParser]
// On Mac OS, we get an ECONNRESET even if there is a full body to be forwarded
@@ -16838,6 +16836,8 @@ async function connectH2 (client, socket) {
socket[kHTTP2Session] = session
util.addListener(socket, 'error', function (err) {
assert(err.code !== 'ERR_TLS_CERT_ALTNAME_INVALID')
this[kError] = err
this[kClient][kOnError](err)
@@ -16911,6 +16911,8 @@ function resumeH2 (client) {
}
function onHttp2SessionError (err) {
assert(err.code !== 'ERR_TLS_CERT_ALTNAME_INVALID')
this[kSocket][kError] = err
this[kClient][kOnError](err)
}
@@ -17608,10 +17610,9 @@ class Client extends DispatcherBase {
// h2
maxConcurrentStreams,
allowH2,
webSocket,
eventSource
webSocket
} = {}) {
super({ webSocket, eventSource })
super({ webSocket })
if (keepAlive !== undefined) {
throw new InvalidArgumentError('unsupported keepAlive, use pipelining=0 instead')
@@ -18132,7 +18133,6 @@ module.exports = Client
const buffer = __nccwpck_require__(4573)
const Dispatcher = __nccwpck_require__(883)
const {
ClientDestroyedError,
@@ -18145,7 +18145,6 @@ const kOnDestroyed = Symbol('onDestroyed')
const kOnClosed = Symbol('onClosed')
const kInterceptedDispatch = Symbol('Intercepted Dispatch')
const kWebSocketOptions = Symbol('webSocketOptions')
const kEventSourceOptions = Symbol('eventSourceOptions')
class DispatcherBase extends Dispatcher {
constructor (opts) {
@@ -18156,7 +18155,6 @@ class DispatcherBase extends Dispatcher {
this[kClosed] = false
this[kOnClosed] = []
this[kWebSocketOptions] = opts?.webSocket ?? {}
this[kEventSourceOptions] = opts?.eventSource ?? {}
}
get webSocketOptions () {
@@ -18166,12 +18164,6 @@ class DispatcherBase extends Dispatcher {
}
}
get eventSourceOptions () {
return {
maxEventSize: this[kEventSourceOptions].maxEventSize ?? buffer.kStringMaxLength
}
}
get destroyed () {
return this[kDestroyed]
}
@@ -24530,7 +24522,6 @@ module.exports = {
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
const buffer = __nccwpck_require__(4573)
const { Transform } = __nccwpck_require__(7075)
const { isASCIINumber, isValidLastEventId } = __nccwpck_require__(4811)
@@ -24555,19 +24546,11 @@ const COLON = 0x3A
*/
const SPACE = 0x20
const defaultMaxEventSize = buffer.kStringMaxLength
const DATA = Buffer.from('data')
const EVENT = Buffer.from('event')
const ID = Buffer.from('id')
const RETRY = Buffer.from('retry')
// Each data field creates a string node, and each unconsumed input chunk keeps
// a Buffer wrapper. The absolute ceiling protects the large default byte limit.
const minParserItems = 1024
const maxParserItems = 131072
const bytesPerParserItem = 128
function isASCIINumberBytes (buffer, start) {
if (start >= buffer.length) {
return false
@@ -24606,12 +24589,6 @@ function isFieldName (line, length, field) {
return true
}
function createMaxEventSizeExceededError () {
const error = new Error('EventSource message size exceeded')
error.aborted = false
return error
}
/**
* @typedef {object} EventSourceStreamEvent
* @type {object}
@@ -24660,13 +24637,6 @@ class EventSourceStream extends Transform {
pos = 0
lineChunkIndex = 0
linePos = 0
lineLength = 0
eventSize = 0
eventFieldSizes = { data: 0, event: 0, id: 0, retry: 0 }
dataLineCount = 0
maxEventSize
maxDataLines
maxBufferedChunks
event = {
data: undefined,
@@ -24677,7 +24647,6 @@ class EventSourceStream extends Transform {
/**
* @param {object} options
* @param {number} [options.maxEventSize]
* @param {eventSourceSettings} options.eventSourceSettings
* @param {Function} [options.push]
*/
@@ -24689,12 +24658,6 @@ class EventSourceStream extends Transform {
super(options)
this.state = options.eventSourceSettings || {}
this.maxEventSize = options.maxEventSize ?? defaultMaxEventSize
const parserItemLimit = this.maxEventSize > 0
? Math.min(maxParserItems, Math.max(minParserItems, Math.floor(this.maxEventSize / bytesPerParserItem)))
: 0
this.maxDataLines = parserItemLimit
this.maxBufferedChunks = parserItemLimit
if (options.push) {
this.push = options.push
}
@@ -24712,14 +24675,6 @@ class EventSourceStream extends Transform {
return
}
// A leading line ending can immediately release the currently buffered
// line, even when it uses the final allowed chunk slot.
if (this.maxEventSize > 0 &&
this.chunks.length >= this.maxBufferedChunks &&
chunk[0] !== LF && chunk[0] !== CR) {
callback(createMaxEventSizeExceededError())
return
}
this.chunks.push(chunk)
// Strip leading byte-order-mark if we opened the stream and started
@@ -24798,12 +24753,7 @@ class EventSourceStream extends Transform {
// In any case, we can process the line as we reached an
// end-of-line character
try {
this.parseLine(this.readLine(), this.event)
} catch (error) {
callback(error)
return
}
this.parseLine(this.readLine(), this.event)
this.consumeCurrentByte()
// A line was processed and this could be the end of the event. We need
// to check if the next line is empty to determine if the event is
@@ -24812,28 +24762,15 @@ class EventSourceStream extends Transform {
continue
}
// readLine() is only called after CR or LF. Reject an unfinished line
// before it can retain an unbounded number of decoded chunks. The seven
// extra bytes allow the longest field prefix ("event: " or "retry: ").
if (this.maxEventSize > 0 && ++this.lineLength > this.maxEventSize + 7) {
callback(createMaxEventSizeExceededError())
return
}
this.advanceCursor()
}
callback()
}
_destroy (error, callback) {
this.chunks.length = 0
this.clearEvent()
super._destroy(error, callback)
}
/**
* @param {Buffer} line
* @param {EventSourceStreamEvent} event
* @param {EventStreamEvent} event
*/
parseLine (line, event) {
// If the line is empty (a blank line)
@@ -24867,13 +24804,6 @@ class EventSourceStream extends Transform {
}
if (isFieldName(line, fieldLength, DATA)) {
if (this.maxEventSize > 0 && this.dataLineCount >= this.maxDataLines) {
throw createMaxEventSizeExceededError()
}
const valueBytes = line.length - valueStart
const dataSize = this.eventFieldSizes.data + (event.data === undefined ? 0 : 1) + valueBytes
this.setEventFieldSize('data', dataSize)
const value = line.toString('utf8', valueStart)
if (event.data === undefined) {
@@ -24881,13 +24811,11 @@ class EventSourceStream extends Transform {
} else {
event.data += `\n${value}`
}
this.dataLineCount++
return
}
if (isFieldName(line, fieldLength, RETRY)) {
if (isASCIINumberBytes(line, valueStart)) {
this.setEventFieldSize('retry', line.length - valueStart)
event.retry = line.toString('utf8', valueStart)
}
return
@@ -24895,29 +24823,20 @@ class EventSourceStream extends Transform {
if (isFieldName(line, fieldLength, ID)) {
if (isValidLastEventIdBytes(line, valueStart)) {
this.setEventFieldSize('id', line.length - valueStart)
event.id = line.toString('utf8', valueStart)
}
return
}
if (isFieldName(line, fieldLength, EVENT)) {
if (valueStart < line.length) {
this.setEventFieldSize('event', line.length - valueStart)
event.event = line.toString('utf8', valueStart)
const value = line.toString('utf8', valueStart)
if (value.length > 0) {
event.event = value
}
}
}
setEventFieldSize (field, size) {
const eventSize = this.eventSize - this.eventFieldSizes[field] + size
if (this.maxEventSize > 0 && eventSize > this.maxEventSize) {
throw createMaxEventSizeExceededError()
}
this.eventSize = eventSize
this.eventFieldSizes[field] = size
}
/**
* @param {EventSourceStreamEvent} event
*/
@@ -24948,12 +24867,6 @@ class EventSourceStream extends Transform {
this.event.event = undefined
this.event.id = undefined
this.event.retry = undefined
this.eventSize = 0
this.dataLineCount = 0
this.eventFieldSizes.data = 0
this.eventFieldSizes.event = 0
this.eventFieldSizes.id = 0
this.eventFieldSizes.retry = 0
}
hasPendingEvent () {
@@ -24989,16 +24902,14 @@ class EventSourceStream extends Transform {
syncLineStartToCursor () {
this.lineChunkIndex = this.chunkIndex
this.linePos = this.pos
this.lineLength = 0
this.dropConsumedChunks()
}
dropConsumedChunks () {
if (this.lineChunkIndex > 0) {
const consumed = this.lineChunkIndex
this.chunks.splice(0, consumed)
this.lineChunkIndex = 0
this.chunkIndex -= consumed
while (this.lineChunkIndex > 0) {
this.chunks.shift()
this.lineChunkIndex--
this.chunkIndex--
}
if (this.chunkIndex === this.chunks.length) {
@@ -25123,7 +25034,6 @@ const { isNetworkError } = __nccwpck_require__(9051)
const { delay } = __nccwpck_require__(4811)
const { kEnumerableProperty } = __nccwpck_require__(3440)
const { environmentSettingsObject } = __nccwpck_require__(3168)
const { getGlobalDispatcher } = __nccwpck_require__(2581)
let experimentalWarned = false
@@ -25405,7 +25315,6 @@ class EventSource extends EventTarget {
const eventSourceStream = new EventSourceStream({
eventSourceSettings: this.#state,
maxEventSize: this.#dispatcher.eventSourceOptions?.maxEventSize,
push: (event) => {
this.dispatchEvent(createFastMessageEvent(
event.type,
@@ -25584,8 +25493,7 @@ webidl.converters.EventSourceInitDict = webidl.dictionaryConverter([
},
{
key: 'dispatcher', // undici only
converter: webidl.converters.any,
defaultValue: () => getGlobalDispatcher()
converter: webidl.converters.any
}
])
@@ -30681,10 +30589,8 @@ async function httpNetworkFetch (
// 19. Run these steps in parallel:
// 1. Run these steps, but abort when fetchParams is canceled:
if (!fetchParams.controller.resume) {
fetchParams.controller.on('terminated', onAborted)
}
fetchParams.controller.onAborted = onAborted
fetchParams.controller.on('terminated', onAborted)
fetchParams.controller.resume = async () => {
// 1. While true
while (true) {
@@ -30853,6 +30759,8 @@ async function httpNetworkFetch (
}
location = headersList.get('location', true)
this.body = new Readable({ read: resume })
const decoders = []
const willFollow = location && request.redirect === 'follow' &&
@@ -30870,7 +30778,7 @@ async function httpNetworkFetch (
// CVE fix similar to urllib3 (GHSA-gm62-xv2j-4w53) and curl (CVE-2022-32206).
const maxContentEncodings = 5
if (codings.length > maxContentEncodings) {
this.abort(new Error(`too many content-encodings in response: ${codings.length}, maximum allowed is ${maxContentEncodings}`))
reject(new Error(`too many content-encodings in response: ${codings.length}, maximum allowed is ${maxContentEncodings}`))
return true
}
@@ -30903,8 +30811,6 @@ async function httpNetworkFetch (
}
}
this.body = new Readable({ read: resume })
const onError = this.onError.bind(this)
resolve({
@@ -30951,6 +30857,10 @@ async function httpNetworkFetch (
fetchParams.controller.off('terminated', this.abort)
}
if (fetchParams.controller.onAborted) {
fetchParams.controller.off('terminated', fetchParams.controller.onAborted)
}
fetchParams.controller.ended = true
this.body.push(null)
@@ -37425,20 +37335,6 @@ class ByteParser extends Writable {
if (isControlFrame(this.#info.opcode)) {
this.#loop = this.parseControlFrame(body)
this.#state = parserStates.INFO
// If the automatic PONG/CLOSE reply filled the socket's write buffer,
// stop parsing and resume on drain so a PING flood cannot grow the
// outbound queue without bound.
const socket = this.ws[kResponse].socket
if (this.#loop && socket.writableNeedDrain) {
this.#loop = false
socket.once('drain', () => {
if (this.destroyed) return
this.#loop = true
this.run(callback)
})
return
}
} else {
if (!this.#info.compressed) {
if (!this.writeFragments(body)) {
@@ -99155,9 +99051,7 @@ class OfficialBuilds extends BaseDistribution {
const versionInfo = await this.getInfoFromManifest(this.nodeInfo.versionSpec, this.nodeInfo.stable, osArch, manifest);
if (versionInfo) {
core_info(`Acquiring ${versionInfo.resolvedVersion} - ${versionInfo.arch} from ${versionInfo.downloadUrl}`);
downloadPath = await downloadTool(versionInfo.downloadUrl, undefined, this.nodeInfo.mirror && this.nodeInfo.mirrorToken
? this.nodeInfo.mirrorToken
: this.nodeInfo.auth);
downloadPath = await downloadTool(versionInfo.downloadUrl, undefined, this.nodeInfo.auth);
if (downloadPath) {
toolPath = await this.extractArchive(downloadPath, versionInfo, false);
}
@@ -99179,7 +99073,7 @@ class OfficialBuilds extends BaseDistribution {
core_info('Falling back to download directly from Node');
}
if (!toolPath) {
toolPath = await this.downloadDirectlyFromNode();
toolPath = await this.downloadDirectlyFromNode(nodeJsVersions);
}
const installedDir = toolPath;
if (this.osPlat != 'win32') {
@@ -99194,12 +99088,24 @@ class OfficialBuilds extends BaseDistribution {
}
addPath(toolPath);
}
async downloadDirectlyFromNode() {
const nodeJsVersions = await this.getNodeJsVersions();
async downloadDirectlyFromNode(nodeJsVersions) {
nodeJsVersions ??= await this.getNodeJsVersions();
const versions = this.filterVersions(nodeJsVersions);
const evaluatedVersion = this.evaluateVersions(versions);
if (!evaluatedVersion) {
throw new Error(`Unable to find Node version '${this.nodeInfo.versionSpec}' for platform ${this.osPlat} and architecture ${this.nodeInfo.arch}.`);
let message = `Unable to find Node version '${this.nodeInfo.versionSpec}' for platform ${this.osPlat} and architecture ${this.nodeInfo.arch}.`;
if (!this.nodeInfo.allowAlpha && this.findAlphaVersion(versions)) {
message += ` A matching alpha release is available; set 'allow-alpha: true' to use it.`;
}
throw new Error(message);
}
// The tool cache cannot match prereleases against a range such as `27`, so reuse a cached alpha here.
if (semver_default().prerelease(evaluatedVersion)) {
const cachedPath = find('node', evaluatedVersion, this.translateArchToDistUrl(this.nodeInfo.arch));
if (cachedPath) {
core_info(`Found in cache @ ${cachedPath}`);
return cachedPath;
}
}
const toolName = this.getNodejsDistInfo(evaluatedVersion);
try {
@@ -99216,7 +99122,6 @@ class OfficialBuilds extends BaseDistribution {
}
}
evaluateVersions(versions) {
let version = '';
if (this.isLatestSyntax(this.nodeInfo.versionSpec)) {
core_info(`getting latest node version...`);
const stableVersion = versions.find(potential => semver_default().prerelease(potential) === null);
@@ -99225,8 +99130,37 @@ class OfficialBuilds extends BaseDistribution {
}
return stableVersion;
}
version = super.evaluateVersions(versions);
return version;
const version = super.evaluateVersions(versions);
if (version || !this.nodeInfo.allowAlpha) {
return version;
}
// Only fall back to an alpha when no stable release matches the spec.
const alphaVersion = this.findAlphaVersion(versions);
if (alphaVersion) {
core_info(`No stable release matches '${this.nodeInfo.versionSpec}', using ${alphaVersion}`);
}
return alphaVersion;
}
// Alphas are matched by their release version, so `27.0.0` or `^27.0.0` select `27.0.0-alpha.*`.
// Ranges with explicit prerelease bounds are already handled by standard semver.
findAlphaVersion(versions) {
const { range } = this.validRange(this.nodeInfo.versionSpec);
if (!semver_default().validRange(range) || this.hasPrereleaseBound(range)) {
return '';
}
return (versions.find(potential => {
const parsed = semver_default().parse(potential);
return (parsed?.prerelease[0] === 'alpha' &&
semver_default().satisfies(`${parsed.major}.${parsed.minor}.${parsed.patch}`, range));
}) ?? '');
}
hasPrereleaseBound(range) {
// semver desugars `27`, `^27.0.0`, etc. into an upper bound such as `<28.0.0-0`; ignore that synthetic `-0`.
return new (semver_default()).Range(range).set.some(comparators => comparators.some(({ operator, semver: bound }) => {
const prerelease = bound.prerelease ?? [];
const isSyntheticUpperBound = operator === '<' && prerelease.length === 1 && prerelease[0] === 0;
return prerelease.length > 0 && !isSyntheticUpperBound;
}));
}
getDistributionUrl(mirror) {
const url = mirror || 'https://nodejs.org';
@@ -99238,9 +99172,7 @@ class OfficialBuilds extends BaseDistribution {
core_debug('Getting manifest from actions/node-versions@main');
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
try {
const manifest = await getManifestFromRepo('actions', 'node-versions', this.nodeInfo.mirror && this.nodeInfo.mirrorToken
? this.nodeInfo.mirrorToken
: this.nodeInfo.auth, 'main');
const manifest = await getManifestFromRepo('actions', 'node-versions', this.nodeInfo.auth, 'main');
if (isValidManifest(manifest)) {
return manifest;
}
@@ -99433,9 +99365,11 @@ async function run() {
const mirrorToken = getInput('mirror-token');
const stable = (getInput('stable') || 'true').toUpperCase() === 'TRUE';
const checkLatest = (getInput('check-latest') || 'false').toUpperCase() === 'TRUE';
const allowAlpha = (getInput('allow-alpha') || 'false').toUpperCase() === 'TRUE';
const nodejsInfo = {
versionSpec: version,
checkLatest,
allowAlpha,
auth,
stable,
arch,
+22
View File
@@ -74,6 +74,28 @@ steps:
- run: npm test
```
## Allow alpha releases
The `allow-alpha` input defaults to `false`. Set it to `true` to use an alpha release when no stable release matches the requested version.
Alphas are matched by their release version, so `27`, `27.x`, `27.0.0`, `^27.0.0`, and `~27.0.0` all select the newest Node.js 27 alpha. Ranges with an explicit prerelease bound, such as `>=27.0.0-alpha.3`, use standard semver matching.
Alpha builds are not published for every platform. For example, Node.js 27 alphas are not available for macOS x64, so setup fails on those runners.
```yaml
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: '27'
allow-alpha: true
package-manager-cache: false # Disable automatic npm caching if not required
- run: npm ci
- run: npm test
```
Exact alpha versions such as `27.0.0-alpha.0.0.0` work without `allow-alpha`.
## Node version file
The `node-version-file` input accepts a path to a file containing the version of Node.js to be used by a project, for example `.nvmrc`, `.node-version`, `.tool-versions`, `mise.toml`, or `package.json`. If both the `node-version` and the `node-version-file` inputs are provided then the `node-version` input is used.
+5 -5
View File
@@ -1,12 +1,12 @@
{
"name": "setup-node",
"version": "7.2.0",
"version": "7.1.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "setup-node",
"version": "7.2.0",
"version": "7.1.0",
"license": "MIT",
"dependencies": {
"@actions/cache": "^6.3.0",
@@ -6624,9 +6624,9 @@
}
},
"node_modules/undici": {
"version": "6.29.1",
"resolved": "https://registry.npmjs.org/undici/-/undici-6.29.1.tgz",
"integrity": "sha512-EvRlUt/QqAEvXdQeRMYUfwOQsfzpDztykrG2owGEE/rBOBoYv9uF39ZzsNDh4lTFHhTr2XOZjKkYgueD12ZmGA==",
"version": "6.29.0",
"resolved": "https://registry.npmjs.org/undici/-/undici-6.29.0.tgz",
"integrity": "sha512-R+RODBqp6i2pPflGdq+xIOUkl+RNfGgHwoinecKu/JCuf2uO06cOKoDbI2P7Dn6KcswdKwrczbU6IYJ6K8X+wg==",
"license": "MIT",
"engines": {
"node": ">=18.17"
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "setup-node",
"version": "7.2.0",
"version": "7.1.0",
"type": "module",
"private": true,
"description": "setup node action",
+1
View File
@@ -3,6 +3,7 @@ export interface NodeInputs {
arch: string;
auth?: string;
checkLatest: boolean;
allowAlpha: boolean;
stable: boolean;
mirror: string;
mirrorToken: string;
@@ -106,9 +106,7 @@ export default class OfficialBuilds extends BaseDistribution {
downloadPath = await tc.downloadTool(
versionInfo.downloadUrl,
undefined,
this.nodeInfo.mirror && this.nodeInfo.mirrorToken
? this.nodeInfo.mirrorToken
: this.nodeInfo.auth
this.nodeInfo.auth
);
if (downloadPath) {
@@ -142,7 +140,7 @@ export default class OfficialBuilds extends BaseDistribution {
}
if (!toolPath) {
toolPath = await this.downloadDirectlyFromNode();
toolPath = await this.downloadDirectlyFromNode(nodeJsVersions);
}
const installedDir = toolPath;
@@ -162,15 +160,30 @@ export default class OfficialBuilds extends BaseDistribution {
core.addPath(toolPath);
}
protected async downloadDirectlyFromNode() {
const nodeJsVersions = await this.getNodeJsVersions();
protected async downloadDirectlyFromNode(nodeJsVersions?: INodeVersion[]) {
nodeJsVersions ??= await this.getNodeJsVersions();
const versions = this.filterVersions(nodeJsVersions);
const evaluatedVersion = this.evaluateVersions(versions);
if (!evaluatedVersion) {
throw new Error(
`Unable to find Node version '${this.nodeInfo.versionSpec}' for platform ${this.osPlat} and architecture ${this.nodeInfo.arch}.`
let message = `Unable to find Node version '${this.nodeInfo.versionSpec}' for platform ${this.osPlat} and architecture ${this.nodeInfo.arch}.`;
if (!this.nodeInfo.allowAlpha && this.findAlphaVersion(versions)) {
message += ` A matching alpha release is available; set 'allow-alpha: true' to use it.`;
}
throw new Error(message);
}
// The tool cache cannot match prereleases against a range such as `27`, so reuse a cached alpha here.
if (semver.prerelease(evaluatedVersion)) {
const cachedPath = tc.find(
'node',
evaluatedVersion,
this.translateArchToDistUrl(this.nodeInfo.arch)
);
if (cachedPath) {
core.info(`Found in cache @ ${cachedPath}`);
return cachedPath;
}
}
const toolName = this.getNodejsDistInfo(evaluatedVersion);
@@ -192,8 +205,6 @@ export default class OfficialBuilds extends BaseDistribution {
}
protected evaluateVersions(versions: string[]): string {
let version = '';
if (this.isLatestSyntax(this.nodeInfo.versionSpec)) {
core.info(`getting latest node version...`);
@@ -210,9 +221,54 @@ export default class OfficialBuilds extends BaseDistribution {
return stableVersion;
}
version = super.evaluateVersions(versions);
const version = super.evaluateVersions(versions);
if (version || !this.nodeInfo.allowAlpha) {
return version;
}
return version;
// Only fall back to an alpha when no stable release matches the spec.
const alphaVersion = this.findAlphaVersion(versions);
if (alphaVersion) {
core.info(
`No stable release matches '${this.nodeInfo.versionSpec}', using ${alphaVersion}`
);
}
return alphaVersion;
}
// Alphas are matched by their release version, so `27.0.0` or `^27.0.0` select `27.0.0-alpha.*`.
// Ranges with explicit prerelease bounds are already handled by standard semver.
private findAlphaVersion(versions: string[]): string {
const {range} = this.validRange(this.nodeInfo.versionSpec);
if (!semver.validRange(range) || this.hasPrereleaseBound(range)) {
return '';
}
return (
versions.find(potential => {
const parsed = semver.parse(potential);
return (
parsed?.prerelease[0] === 'alpha' &&
semver.satisfies(
`${parsed.major}.${parsed.minor}.${parsed.patch}`,
range
)
);
}) ?? ''
);
}
private hasPrereleaseBound(range: string): boolean {
// semver desugars `27`, `^27.0.0`, etc. into an upper bound such as `<28.0.0-0`; ignore that synthetic `-0`.
return new semver.Range(range).set.some(comparators =>
comparators.some(({operator, semver: bound}) => {
const prerelease = bound.prerelease ?? [];
const isSyntheticUpperBound =
operator === '<' && prerelease.length === 1 && prerelease[0] === 0;
return prerelease.length > 0 && !isSyntheticUpperBound;
})
);
}
protected getDistributionUrl(mirror: string): string {
@@ -229,9 +285,7 @@ export default class OfficialBuilds extends BaseDistribution {
const manifest = await tc.getManifestFromRepo(
'actions',
'node-versions',
this.nodeInfo.mirror && this.nodeInfo.mirrorToken
? this.nodeInfo.mirrorToken
: this.nodeInfo.auth,
this.nodeInfo.auth,
'main'
);
if (isValidManifest(manifest)) {
+3
View File
@@ -47,9 +47,12 @@ export async function run() {
(core.getInput('stable') || 'true').toUpperCase() === 'TRUE';
const checkLatest =
(core.getInput('check-latest') || 'false').toUpperCase() === 'TRUE';
const allowAlpha =
(core.getInput('allow-alpha') || 'false').toUpperCase() === 'TRUE';
const nodejsInfo = {
versionSpec: version,
checkLatest,
allowAlpha,
auth,
stable,
arch,