@@ -2,7 +2,7 @@ name: Update Yonode Package
22
33on :
44 schedule :
5- # Runs every day at 05:00 UTC
5+ # Runs every 5 minutes
66 - cron : ' */5 * * * *'
77 workflow_dispatch :
88
@@ -12,24 +12,39 @@ jobs:
1212 steps :
1313 - name : Checkout repository
1414 uses : actions/checkout@v3
15+ with :
16+ fetch-depth : 0 # Important to fetch all history for branch operations
1517
1618 - name : Set up Node.js
1719 uses : actions/setup-node@v3
1820 with :
1921 node-version : ' 16'
20-
22+
2123 - name : Change directory to yonode
2224 run : cd packages/yonode-templates/JS-MongoDB-Mongoose-Auth-Template
2325
2426 - name : Install npm-check-updates
2527 run : npm install -g npm-check-updates
2628
27- - name : Update package.json if newer versions are available
29+ - name : Check for updated packages
30+ run : ncu -u
31+
32+ - name : Install updated packages
33+ run : npm install
34+
35+ - name : Commit updated package.json and package-lock.json
36+ run : |
37+ git config --local user.email "action@github.com"
38+ git config --local user.name "GitHub Action"
39+ git add package.json package-lock.json
40+ git diff-index --quiet HEAD || git commit -m "Update dependencies"
41+
42+ - name : Push changes
2843 run : |
29- ncu -u
44+ git checkout -b update-yonode-dependencies
45+ git push origin update-yonode-dependencies
3046
3147 - name : Create Pull Request for updated package.json
32- id : cpr
3348 uses : peter-evans/create-pull-request@v4
3449 with :
3550 commit-message : Update dependencies in Yonode
0 commit comments