-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (41 loc) · 1.36 KB
/
update_npm.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: Update Node.js and npm Packages
on:
schedule:
- cron: '0 0 */1 * *'
workflow_dispatch:
jobs:
update-packages:
runs-on: ubuntu-latest
steps:
# 1. Repository auschecken
- name: Checkout repository
uses: actions/checkout@v4
# 2. Node.js und Yarn einrichten
- name: Set up Node.js and Yarn
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'yarn'
# 3. npm-check-updates installieren
- name: Install npm-check-updates (ncu)
run: npm install -g npm-check-updates
# 4. Aktualisiere die package.json
- name: Update package.json dependencies
run: ncu -u
# 5. Installiere die aktualisierten Pakete und aktualisiere yarn.lock
- name: Install updated dependencies
run: yarn install
# 6. Änderungen committen und pushen
- name: Commit and push changes
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git add .
if git diff-index --quiet HEAD --; then
echo "No changes to commit";
else
git commit -m "chore: upgrade dependencies (package.json and yarn.lock)"
git push --force "https://${TOKEN}@github.com/${{ github.repository }}.git"
fi