Skip to content

Commit

Permalink
ci: fix scheduled-weekly-new-nodejs-lts-check.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
thomvaill committed Nov 21, 2024
1 parent 8af9223 commit 2d32748
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions .github/workflows/scheduled-weekly-new-nodejs-lts-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,27 @@ jobs:
needs: load-nodejs-supported-versions
runs-on: ubuntu-latest
steps:
- name: Get latest Node.js LTS versions
run: |
curl -s https://nodejs.org/dist/index.json | jq '[.[] | select(.lts != false)] | .[0]' > latest-lts.json
CURRENT_LTS="$(jq -r '.version' latest-lts.json | sed 's/v//')"
echo "Latest LTS version: ${CURRENT_LTS}"
- name: Compare with supported versions
- name: Compare supported versions with current active Node.js LTS
id: check-version
run: |
SUPPORTED_VERSIONS="${{ needs.load-nodejs-supported-versions.outputs.node_versions }}"
if [[ ! "${SUPPORTED_VERSIONS}" =~ "${CURRENT_LTS}" ]]
then
echo "A new Node.js LTS version is available: ${CURRENT_LTS}"
echo "::set-output name=new_lts_version::${CURRENT_LTS}"
else
echo "No new Node.js LTS version detected"
fi
active_lts="$(curl -s https://nodejs.org/dist/index.json \
| jq -r '[.[] | select(.lts != false)] | .[0].version' \
| sed 's/v//' \
| cut -d. -f1)"
echo "Current active Node.js LTS is ${active_lts}"
while read -r version
do
if [[ "$(echo "${version}" | cut -d. -f1)" == "${active_lts}" ]]
then
echo "> is already supported"
exit 0
fi
done < <(echo '${{ needs.load-nodejs-supported-versions.outputs.node_versions }}' | jq -r -c '.[]')
echo "> is NOT yet supported!"
echo "new_lts_version=${active_lts}" >> "${GITHUB_OUTPUT}"
- name: Create an issue if new LTS
if: steps.check-version.outputs.new_lts_version
Expand Down

0 comments on commit 2d32748

Please sign in to comment.