Auto dependency updater #631
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 | |
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 | |
ref: "main" | |
# - uses: pnpm/[email protected] | |
# with: | |
# run_install: false | |
# version: 7 | |
# - uses: actions/setup-node@v4 | |
# with: | |
# cache: pnpm | |
# node-version: 16 | |
# https://github.com/pnpm/action-setup#use-cache-to-reduce-installation-time | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
# cache: pnpm | |
node-version: 16 | |
- uses: pnpm/action-setup@v4 | |
name: Install pnpm | |
id: pnpm-install | |
with: | |
version: 7 | |
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 | |
name: Setup pnpm cache | |
with: | |
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store # -${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store | |
- name: Create new branch | |
run: git checkout -b chore/auto-update-deps | |
- name: Show code | |
run: ls -la | |
working-directory: dev | |
- name: Install tools | |
run: npm i npm-check-updates --no-save --legacy-peer-deps | |
working-directory: dev | |
- name: Update dependencies | |
run: npm run update | |
working-directory: dev | |
- name: Reinstall dependencies | |
run: pnpm install --no-frozen-lockfile | |
working-directory: dev | |
- name: Commit changed files | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add **/package.json **/pnpm-lock.yaml | |
git status | |
git commit -m "chore: auto dependency update" | |
- uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: "chore/auto-update-deps" | |
force: true |