Skip to content

Weekly new Node.js LTS check #1

Weekly new Node.js LTS check

Weekly new Node.js LTS check #1

name: Weekly new Node.js LTS check
on:
workflow_dispatch:
# Run on every Sunday to check if a new Node.js LTS that we don't support is released, and create an Issue if this is the case
schedule:
- cron: "0 4 * * 0"
defaults:
run:
shell: bash
jobs:
load-nodejs-supported-versions:
uses: ./.github/workflows/reusable-load-nodejs-supported-versions.yml
lts-check:
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
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
- name: Create an issue if new LTS
if: steps.check-version.outputs.new_lts_version
uses: peter-evans/create-issue-from-file@v5
with:
title: "New Node.js LTS version: ${{ steps.check-version.outputs.new_lts_version }}"
content-filepath: .github/auto-issue-templates/new-node-lts.md
labels: |
auto
maintenance