Skip to content

Weekly new Node.js LTS check #10

Weekly new Node.js LTS check

Weekly new Node.js LTS check #10

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:
- uses: actions/checkout@v4
with:
sparse-checkout: |
.github
- name: Compare supported versions with current active Node.js LTS
id: check-version
run: |
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: Find the last open LTS issue
id: last-issue
uses: micalevisk/last-issue-action@v2
with:
state: open
labels: |
auto-node-lts
- name: Create an issue if new LTS and not yet opened
if: ${{ steps.check-version.outputs.new_lts_version != '' && steps.last-issue.outputs.has-found != 'true' }}
uses: peter-evans/create-issue-from-file@v5
with:
title: "Support new Node.js LTS version: ${{ steps.check-version.outputs.new_lts_version }}"
content-filepath: .github/auto-issue-templates/new-node-lts.md
labels: |
auto-node-lts
maintenance