-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (55 loc) · 1.9 KB
/
update-node.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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}}