Skip to content

Commit 47937ae

Browse files
committed
fix: input instead of env
1 parent ee2f66f commit 47937ae

4 files changed

Lines changed: 13 additions & 8 deletions

File tree

.github/actions/determineNodeVersions/action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ inputs:
44
nodeVersionOverride:
55
description: Set node to a specific Semver version
66
required: false
7+
nodeDisableVersions:
8+
description: A string of major version(s) to disable (18 or 18,23)
9+
required: false
710
outputs:
811
nodeVersions:
912
description: Node versions to be consumed by a workflow matrix
@@ -27,4 +30,6 @@ runs:
2730
shell: bash
2831
id: node-versions
2932
run: node "$GITHUB_ACTION_PATH/dist/index.js"
33+
with:
34+
nodeDisableVersions: ${{ inputs.nodeDisableVersions }}
3035

.github/actions/determineNodeVersions/src/main.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
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

1010
type 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
}

.github/workflows/unitTestsLinux.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
id: determine-node-versions
1818
with:
1919
nodeVersionOverride: ${{ vars.NODE_VERSION_OVERRIDE }} # default is 'lts/*'
20+
nodeDisableVersions: ${{ vars.NODE_DISABLE_VERSIONS }}
2021

2122
prevent-typescript-dependency:
2223
if: ${{ inputs.skipTsDepCheck == false }}

.github/workflows/unitTestsWindows.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ jobs:
1111
id: determine-node-versions
1212
with:
1313
nodeVersionOverride: ${{ vars.NODE_VERSION_OVERRIDE }} # default is 'lts/*'
14+
nodeDisableVersions: ${{ vars.NODE_DISABLE_VERSIONS }}
1415

1516
windows-unit-tests:
1617
needs: determine-node-versions

0 commit comments

Comments
 (0)