55 * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66 */
77
8- import { setFailed , setOutput , notice } from '@actions/core' ;
8+ import { setFailed , getInput , setOutput , notice } from '@actions/core' ;
99
1010type VersionData = {
1111 start : string ;
@@ -30,11 +30,9 @@ export const getVersions = async () => {
3030 // This will ensure that the unit tests run on the same version that will be shipped
3131 const installedNode = process . versions . node ;
3232
33- console . log ( "disabled 23:" , process . env . NODE_DISABLE_VERSION_23 ) ;
34-
35- // Support disabling certain versions via an environment variable
36- // They will be named like `NODE_DISABLE_VERSION_18` and will be set to `true`
37- const disabledVersions = Object . keys ( process . env ) . filter ( ( env ) => env . startsWith ( 'NODE_DISABLE_VERSION_' ) ) . map ( ( env ) => env . replace ( 'NODE_DISABLE_VERSION_' , '' ) ) ;
33+ // Comma separated list of major versions to disable
34+ // For example: Set `NODE_DISABLE_VERSIONS` to `18,23`
35+ const disableVersions = getInput ( 'nodeDisableVersions' ) . split ( ',' ) ;
3836
3937 const today = new Date ( ) ;
4038
@@ -46,9 +44,9 @@ export const getVersions = async () => {
4644 return today >= startDate && today <= endDate ;
4745 } )
4846 . map ( ( version ) => version . replace ( 'v' , '' ) )
49- // Remove versions that are disabled via env vars
47+ // Remove versions that are disabled via input (via env var)
5048 . filter ( ( version ) => {
51- if ( disabledVersions . includes ( version ) ) {
49+ if ( disableVersions . includes ( version ) ) {
5250 notice ( `Node version ${ version } is disabled via env var` ) ;
5351 return false ;
5452 }
0 commit comments