Skip to content

Update Node

Update Node #1071

Workflow file for this run

name: Update Node
on:
push:
branches: main
paths: .github/workflows/update-node.yml
schedule:
- cron: '0 15 * * *'
workflow_dispatch:
permissions:
contents: read
concurrency: update-node
jobs:
update-node:
name: Update Node
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v4.1.5
- name: Determine info
shell: bash
id: info
run: |
OLD_VERSION=$(<.nvmrc)
NEW_VERSION=$(curl -sSf https://resolve-node.vercel.app/lts)
NEW_VERSION=${NEW_VERSION#'v'}
UPDATE_TITLE="chore(node): bump from $OLD_VERSION to $NEW_VERSION"
UPDATE_BODY="Bump Node from $OLD_VERSION to $NEW_VERSION."
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
echo "update-title=$UPDATE_TITLE" >> $GITHUB_OUTPUT
echo "update-body=$UPDATE_BODY" >> $GITHUB_OUTPUT
- name: Update .nvmrc
run: echo '${{steps.info.outputs.version}}' > .nvmrc
- name: Handle changes
uses: peter-evans/create-pull-request@v6.0.5
id: changes
with:
token: ${{secrets.AUTOMATION_TOKEN}}
commit-message: ${{steps.info.outputs.update-title}}
committer: ${{env.GIT_USER}}
add-paths: .nvmrc
author: ${{env.GIT_USER}}
branch: auto/update-node
delete-branch: true
title: ${{steps.info.outputs.update-title}}
body: ${{steps.info.outputs.update-body}}
labels: auto,dependencies
env:
GIT_USER: ${{secrets.AUTOMATION_USER}} <${{secrets.AUTOMATION_EMAIL}}>
- name: Enable auto-merge
if: steps.changes.outputs.pull-request-operation == 'created'
run: gh pr merge --auto --rebase "$PULL_REQUEST_URL"
env:
PULL_REQUEST_URL: ${{steps.changes.outputs.pull-request-url}}
GITHUB_TOKEN: ${{secrets.AUTOMATION_TOKEN}}