Skip to content

Commit 6421dfb

Browse files
chore: Automatic modules update via CICD
1 parent 2e7293f commit 6421dfb

File tree

2 files changed

+64
-1
lines changed

2 files changed

+64
-1
lines changed

.github/workflows/pull-request.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
name: Pull Request CI
1+
name: Pull Request CI check
22

33
on:
4+
workflow_dispatch:
45
pull_request:
56
branches:
67
- main
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Update NPM Packages
2+
3+
on:
4+
schedule:
5+
- cron: "0 0 * * 0"
6+
workflow_dispatch:
7+
8+
env:
9+
node_version: 20
10+
11+
jobs:
12+
update-packages:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- uses: actions/setup-node@v4
20+
with:
21+
node-version: ${{ env.node_version }}
22+
cache: "npm"
23+
24+
- name: Install npm-check-updates
25+
run: npm install -g npm-check-updates
26+
27+
- name: Find all package.json files
28+
id: find-packages
29+
run: |
30+
echo "::set-output name=matrix::$(find . -name 'package.json' -not -path '*/node_modules/*' | jq -R -s -c 'split("\n")[:-1]')"
31+
32+
- name: Update packages in each package.json
33+
run: |
34+
package_files=$(find . -name 'package.json' -not -path '*/node_modules/*')
35+
for file in $package_files; do
36+
dir=$(dirname "$file")
37+
echo "Updating packages in $dir"
38+
(cd "$dir" && ncu -u)
39+
done
40+
41+
- name: Install updated packages in root
42+
run: npm install --force
43+
44+
- name: Commit updated package.json files
45+
run: |
46+
git config --global user.name "GitHub Actions"
47+
git config --global user.email "[email protected]"
48+
git add .
49+
git commit -m "fix: Update dependencies" --no-verify || true
50+
51+
- name: Create Pull Request
52+
uses: peter-evans/create-pull-request@v6
53+
with:
54+
token: ${{ secrets.PRIVATE_GITHUB_TOKEN }}
55+
commit-message: "fix: Update dependencies"
56+
title: "fix: Update NPM dependencies"
57+
body: "This is an auto-generated PR with dependency updates."
58+
branch: "fix/update-dependencies"
59+
delete-branch: true
60+
61+
- name: Check output
62+
run: echo "Pull Request Number - ${{ steps.create-pull-request.outputs.pull-request-number }}"

0 commit comments

Comments
 (0)