Skip to content

Commit b0e2493

Browse files
committed
chore: enhance auto-dependency updater workflow with improved structure and checks
1 parent d964a62 commit b0e2493

File tree

1 file changed

+68
-25
lines changed

1 file changed

+68
-25
lines changed
Lines changed: 68 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,87 @@
11
name: Auto dependency updater
22

3+
env:
4+
issue: 6350
5+
36
on:
47
schedule:
5-
- cron: "0 2 * * *"
8+
- cron: '0 2 * * 0'
69
workflow_dispatch:
710

11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
815
jobs:
916
update:
1017
runs-on: ubuntu-latest
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
include:
22+
- base: main
23+
version: v3
24+
- base: release/2
25+
version: v2
26+
env:
27+
version: ${{ matrix.version }}
1128
steps:
1229
- uses: actions/checkout@v5
1330
with:
1431
fetch-depth: 0
32+
ref: ${{ matrix.base }}
1533
persist-credentials: false
16-
ref: "main"
17-
- uses: ./.github/actions/pnpm-setup
18-
- name: Create new branch
19-
run: git checkout -b chore/auto-update-deps
20-
- name: Show code
21-
run: ls -la
22-
working-directory: dev
23-
- name: Install tools
24-
run: npm i npm-check-updates --no-save --legacy-peer-deps
25-
working-directory: dev
34+
- uses: actions/setup-node@v5
35+
with:
36+
# cache: pnpm
37+
node-version: 22
38+
- uses: pnpm/action-setup@v4
39+
id: pnpm-install
40+
with:
41+
version: 10
42+
run_install: false
43+
- name: Get pnpm store directory
44+
id: pnpm-cache
45+
shell: bash
46+
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
47+
- uses: actions/cache@v4
48+
with:
49+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
50+
key: ${{ runner.os }}-pnpm-store
51+
restore-keys: |
52+
${{ runner.os }}-pnpm-store
53+
54+
- name: Install
55+
run: pnpm i --no-frozen-lockfile
2656
- name: Update dependencies
27-
run: npm run update
28-
working-directory: dev
57+
run: pnpm run update
2958
- name: Reinstall dependencies
30-
run: pnpm install --no-frozen-lockfile
31-
working-directory: dev
32-
- name: Commit changed files
59+
run: pnpm i --no-frozen-lockfile
60+
61+
- name: Check for changes
62+
id: verify-changed-files
3363
run: |
34-
git config --local user.email "[email protected]"
35-
git config --local user.name "GitHub Action"
36-
git add **/package.json **/pnpm-lock.yaml
37-
git status
38-
git commit -m "chore: auto dependency update"
64+
if [ -n "$(git status --porcelain)" ]; then
65+
echo "changed=true" >> $GITHUB_OUTPUT
66+
else
67+
echo "changed=false" >> $GITHUB_OUTPUT
68+
fi
3969
40-
- uses: ad-m/github-push-action@master
70+
- name: Create Pull Request
71+
if: steps.verify-changed-files.outputs.changed == 'true'
72+
uses: peter-evans/create-pull-request@v7
4173
with:
42-
github_token: ${{ secrets.GITHUB_TOKEN }}
43-
branch: "chore/auto-update-deps"
44-
force: true
74+
base: ${{ matrix.base }}
75+
branch: ${{ env.issue }}-${{ env.version }}/auto-update-deps
76+
commit-message: 'chore: update dependencies and lock file'
77+
title: 'chore(${{ env.version }}): update dependencies and lock file'
78+
body: 'Automated dependency updates from issue #${{ env.issue }} for ${{ env.version }}.'
79+
delete-branch: true
80+
81+
- name: Quality Checks
82+
if: steps.verify-changed-files.outputs.changed == 'true'
83+
run: |
84+
pnpm build
85+
pnpm format
86+
pnpm lint
87+
pnpm unused

0 commit comments

Comments
 (0)