Sync Models from models.dev #4
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: Sync Models from models.dev | |
| on: | |
| schedule: | |
| # 每天 UTC 时间 0:00 运行 | |
| - cron: '0 0 * * *' | |
| workflow_dispatch: | |
| # 允许手动触发 | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Sync models from models.dev | |
| run: npm run sync | |
| - name: Validate data | |
| run: npm run validate | |
| - name: Check for changes | |
| id: changes | |
| run: | | |
| git diff --quiet || echo "changes=true" >> $GITHUB_OUTPUT | |
| - name: Commit and push changes | |
| if: steps.changes.outputs.changes == 'true' | |
| run: | | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| git add -A | |
| git commit -m "chore: sync models from models.dev [skip ci]" | |
| git push |