88 nodeDisableCurrent :
99 description : Disable testing on Node "current"
1010 required : false
11+ nodeDisablePrevious :
12+ description : Disable testing on Node "-1"
13+ required : false
1114
1215outputs :
1316 nodeVersions :
@@ -41,16 +44,29 @@ runs:
4144 id : node-versions
4245 run : |
4346 # Current can be disabled by setting the "nodeDisableCurrent" input to "true"
47+ # Previous LTS can be disabled by setting the "nodeDisablePrevious" input to "true"
4448 # IF "NODE_VERSION" is overridden, "NODE_VERSION_CURRENT" will also be disabled
49+
4550 NODE_VERSION_CURRENT="current"
46- NODE_VERSION="${INPUTS_NODE_VERSION_OVERRIDE:-lts/*}"
47- NODE_PREVIOUS_LTS="lts/-1"
51+ if [ "$INPUTS_NODE_DISABLE_CURRENT" = "true" ] || [ -n "$INPUTS_NODE_VERSION_OVERRIDE" ]; then
52+ NODE_VERSION_CURRENT=""
53+ fi
4854
55+ NODE_VERSION="lts/*"
4956 if [ -n "$INPUTS_NODE_VERSION_OVERRIDE" ]; then
57+ NODE_VERSION="$INPUTS_NODE_VERSION_OVERRIDE"
58+ fi
59+
60+ NODE_PREVIOUS_LTS="lts/-1"
61+ if [ "$INPUTS_NODE_DISABLE_PREVIOUS" = "true" ]; then
62+ NODE_PREVIOUS_LTS=""
63+ fi
64+
65+ if [ -n "$INPUTS_NODE_VERSION_OVERRIDE" ] && [ "$INPUTS_NODE_DISABLE_PREVIOUS" != "true" ] ; then
5066 NODE_VERSION_MAJOR=$(echo "$INPUTS_NODE_VERSION_OVERRIDE" | cut -d '.' -f 1)
5167
5268 # LTS-1 will always be the previous LTS, which is always even. Here we calculate the nearest LTS
53- if [ $((NODE_VERSION_MAJOR % 2)) == 0 ]; then
69+ if [ $((NODE_VERSION_MAJOR % 2)) = 0 ]; then
5470 NODE_PREVIOUS_LTS="$((NODE_VERSION_MAJOR - 2))"
5571 else
5672 NODE_PREVIOUS_LTS="$((NODE_VERSION_MAJOR - 1))"
@@ -59,13 +75,10 @@ runs:
5975
6076 {
6177 echo "nodeVersions<<EOF"
62- if [ "$NODE_VERSION" = "lts/*" ] && [ "$INPUTS_NODE_DISABLE_CURRENT" != "true" ]; then
63- jq -n --arg v1 "$NODE_VERSION_CURRENT" --arg v2 "$NODE_VERSION" --arg v3 "$NODE_PREVIOUS_LTS" '[$v1, $v2, $v3]'
64- else
65- jq -n --arg v1 "$NODE_VERSION" --arg v2 "$NODE_PREVIOUS_LTS" '[$v1, $v2]'
66- fi
78+ jq -n --arg v1 "$NODE_VERSION_CURRENT" --arg v2 "$NODE_VERSION" --arg v3 "$NODE_PREVIOUS_LTS" '[$v1, $v2, $v3] | map(select(. != ""))'
6779 echo "EOF"
6880 } >> "$GITHUB_OUTPUT"
6981 env :
7082 INPUTS_NODE_VERSION_OVERRIDE : ${{ inputs.nodeVersionOverride }}
7183 INPUTS_NODE_DISABLE_CURRENT : ${{ inputs.nodeDisableCurrent }}
84+ INPUTS_NODE_DISABLE_PREVIOUS : ${{ inputs.nodeDisablePrevious }}
0 commit comments