-
Notifications
You must be signed in to change notification settings - Fork 1
65 lines (54 loc) · 2 KB
/
update-dependencies.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: update-dependencies
on:
schedule:
- cron: "47 4 * * *"
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3
- name: Setup nodejs version
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
with:
node-version-file: ".node-version"
- name: Install dependencies
run: npm ci
- name: Apply updates
run: npm run update
- name: Check for modified files
id: gitCheck
run: |
echo "diff=$(git diff -U0 package.json | grep -e '^+ ' | awk '{ print $2 }' | sed 's/[\":]//g' | xargs | sed -e 's/ / + /g')" >>$GITHUB_OUTPUT
if [ -n "$(git status --porcelain)" ]; then
echo "modified=true" >> $GITHUB_OUTPUT
else
echo "modified=false" >> $GITHUB_OUTPUT
fi
cat $GITHUB_OUTPUT
- name: Update package-lock
id: update-package-lock
if: steps.gitCheck.outputs.modified == 'true'
run: |
npm install
- name: Create Pull Request
id: createPR
if: steps.gitCheck.outputs.modified == 'true'
uses: peter-evans/create-pull-request@v5
with:
branch: update-dependencies
author: Dependency Updater <dependency-updater@users.noreply.github.com>
commit-message: "chore: update dependencies for ${{steps.gitCheck.outputs.diff}}"
title: Update dependencies
body: |
- Dependency updates
Auto-generated by [create-pull-request][1]
[1]: https://github.com/peter-evans/create-pull-request
delete-branch: true
labels: automated pr
- name: Enable auth-merge
if: steps.gitCheck.outputs.modified == 'true'
uses: peter-evans/enable-pull-request-automerge@v3
with:
pull-request-number: ${{ steps.createPR.outputs.pull-request-number }}
merge-method: rebase