0x3f-problem-datasources #34
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: 0x3f-problem-datasources | |
| on: | |
| schedule: | |
| - cron: '0 0 * * 0' # 每周日UTC时间0点 | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| env: | |
| NODE_ENV: production | |
| PROJECT_DIR: 0x3f-problem-datasources | |
| TZ: Asia/Shanghai | |
| jobs: | |
| update-data: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| # 必须先安装 pnpm 再 setup-node | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v2 | |
| with: | |
| version: 8 | |
| run_install: false # 我们稍后会手动安装依赖 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| cache: 'pnpm' | |
| cache-dependency-path: ${{ env.PROJECT_DIR }}/pnpm-lock.yaml | |
| - name: Install dependencies | |
| working-directory: ${{ env.PROJECT_DIR }} | |
| run: | | |
| pnpm install --frozen-lockfile | |
| - name: Run update script | |
| working-directory: ${{ env.PROJECT_DIR }} | |
| run: pnpm dev | |
| - name: Commit and push changes | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| git config --global user.name "wuxin0011" | |
| git config --global user.email "[email protected]" | |
| git add . | |
| git diff-index --quiet HEAD || git commit -m "Auto-update data [skip ci]" | |
| git push origin HEAD:${{ github.ref_name }} |