Merge pull request #126 from BlackishGreen33/dependabot/npm_and_yarn/… #223
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: Crawl Data | |
on: | |
schedule: | |
- cron: '0 4 * * *' # Run daily at 12:00 PM UTC+8 (4:00 AM UTC) | |
push: | |
branches: [main] | |
workflow_dispatch: | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
concurrency: | |
group: crawl | |
cancel-in-progress: false | |
jobs: | |
crawl: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
cache: npm | |
- name: Checkout to result branch | |
run: | | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git checkout --orphan result | |
git pull origin result | |
git reset | |
- name: pnpm setup | |
uses: pnpm/action-setup@v3 | |
with: | |
version: '9.1.2' | |
- name: Install node modules | |
run: pnpm install | |
- name: Crawl data | |
run: pnpm run crawldata | |
- name: Push to result branch | |
run: | | |
git add result/* -f | |
git commit -m "$(TZ=Asia/Shanghai date +"%Y-%m-%d %H:%M:%S")" | |
git push origin result |