Skip to content

Update nvmrc

Update nvmrc #9

Workflow file for this run

name: Update .nvmrc
on:
pull_request:
branches:
- main
paths:
- 'Dockerfile'
types: [opened, synchronize]
jobs:
update-nvmrc:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # pin@v3
with:
fetch-depth: 0
- name: Extract Node.js version from Dockerfile
id: extract_version
run: |
VERSION=$(grep -oP 'FROM node:\K[0-9]+\.[0-9]+\.[0-9]+' Dockerfile)
echo "NODE_VERSION=$VERSION" >> $GITHUB_ENV
- name: Set up Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Create a new branch
id: create_branch
run: |
BRANCH_NAME=update-nvmrc-${{ github.sha }}
echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_ENV
git checkout -b $BRANCH_NAME
- name: Update .nvmrc
run: |
echo "$NODE_VERSION" > .nvmrc
git add .nvmrc
git commit -m "Update .nvmrc to Node.js version $NODE_VERSION"
- name: Push changes to new branch
run: |
git push origin $BRANCH_NAME
- name: Create pull request
uses: peter-evans/create-pull-request@5874ea5902f1f64af5cc21e1112355f468bb9e7a
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update .nvmrc to Node.js version ${{ env.NODE_VERSION }}
branch: ${{ env.BRANCH_NAME }}
title: Update .nvmrc to Node.js version ${{ env.NODE_VERSION }}
body: This PR updates .nvmrc to Node.js version ${{ env.NODE_VERSION }}
base: main