|
1 | 1 | name: Auto dependency updater |
2 | 2 |
|
| 3 | +env: |
| 4 | + issue: 6350 |
| 5 | + |
3 | 6 | on: |
4 | 7 | schedule: |
5 | | - - cron: "0 2 * * *" |
| 8 | + - cron: '0 2 * * 0' |
6 | 9 | workflow_dispatch: |
7 | 10 |
|
| 11 | +permissions: |
| 12 | + contents: write |
| 13 | + pull-requests: write |
| 14 | + |
8 | 15 | jobs: |
9 | 16 | update: |
10 | 17 | 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 }} |
11 | 28 | steps: |
12 | 29 | - uses: actions/checkout@v5 |
13 | 30 | with: |
14 | 31 | fetch-depth: 0 |
| 32 | + ref: ${{ matrix.base }} |
15 | 33 | 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 |
26 | 56 | - name: Update dependencies |
27 | | - run: npm run update |
28 | | - working-directory: dev |
| 57 | + run: pnpm run update |
29 | 58 | - 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 |
33 | 63 | 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 |
39 | 69 |
|
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 |
41 | 73 | 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