Auto Update Modules #156
This file contains hidden or 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 Update Modules | |
| on: | |
| schedule: | |
| # 每天 UTC 时间 0 点运行 (北京时间 8 点) | |
| - cron: '0 0 * * *' | |
| # 允许手动触发 | |
| workflow_dispatch: | |
| jobs: | |
| update-modules: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| registry-url: https://registry.npmjs.org/ | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v2 | |
| with: | |
| version: 8 | |
| - name: Install npm-check-updates | |
| run: pnpm add -g npm-check-updates | |
| - name: Run module update | |
| run: pnpm module:update | |
| - name: Check for changes | |
| id: git-check | |
| run: | | |
| git diff --exit-code || echo "changes=true" >> $GITHUB_OUTPUT | |
| - name: Commit and push changes | |
| if: steps.git-check.outputs.changes == 'true' | |
| run: | | |
| git config --global user.name 'zxwk1998' | |
| git config --global user.email 'zxwk1998@users.noreply.github.com' | |
| git add . | |
| git commit -m "♻️ refactor: code" | |
| git push | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |