-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (40 loc) · 1.1 KB
/
auto-maintenance.yaml
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
name: Automatic Maintenance
on:
# Allow manual triggers.
workflow_dispatch:
# Automatically run once a week.
schedule:
- cron: "0 7 * * SUN"
jobs:
update-npm:
name: "Update NPM packages"
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v3
with:
ref: main
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: Update packages
run: |
npm update
- name: Check if there are changes
id: changes
run: echo "changed=$(git status --porcelain | wc -l | xargs)" >> "$GITHUB_OUTPUT"
shell: bash
- name: Create a PR with the updates
if: steps.changes.outputs.changed > 0
id: create-pr
uses: peter-evans/create-pull-request@v5
with:
commit-message: Update NPM packages
branch: automated/update-packages
delete-branch: true
title: Update NPM packages
body: NPM lockfile updated
base: main