Auto dependency updater #803
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Auto dependency updater | |
env: | |
issue: 6350 | |
version: v2 | |
on: | |
schedule: | |
- cron: '0 2 * * *' | |
workflow_dispatch: | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
persist-credentials: false | |
# - uses: pnpm/action-setup@v4 | |
# with: | |
# run_install: false | |
# version: 8 | |
# - uses: actions/setup-node@v4 | |
# with: | |
# cache: pnpm | |
# node-version: 20 | |
# https://github.com/pnpm/action-setup#use-cache-to-reduce-installation-time | |
- uses: actions/setup-node@v4 | |
with: | |
# cache: pnpm | |
node-version: 20 | |
- uses: pnpm/action-setup@v4 | |
id: pnpm-install | |
with: | |
version: 9 | |
run_install: false | |
- name: Get pnpm store directory | |
id: pnpm-cache | |
shell: bash | |
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v4 | |
with: | |
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store | |
restore-keys: | | |
${{ runner.os }}-pnpm-store | |
- name: Create update branch | |
run: git checkout -b ${{env.issue}}-${{env.version}}/auto-update-deps | |
- name: Install | |
run: pnpm i --workspace-root | |
- name: Update dependencies | |
run: pnpm ncu:minor | |
- name: Reinstall dependencies | |
run: pnpm i --no-frozen-lockfile | |
- name: Commit changed files | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git add **/package.json pnpm-lock.yaml | |
git status | |
HUSKY=0 git commit -m "chore: update dependencies and lock file" | |
- uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{env.issue}}-${{env.version}}/auto-update-deps | |
force: true |