This repository was archived by the owner on Aug 8, 2025. It is now read-only.
Run Scrapper Twice a day #42
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: Run Scrapper Twice a day | |
| on: | |
| schedule: | |
| - cron: '0 0,12 * * *' # twice a day, midnight and noon UTC | |
| permissions: | |
| contents: write | |
| jobs: | |
| run-builder-scrapper: | |
| runs-on: ubuntu-latest | |
| env: | |
| REDDIT_CLIENT_ID: ${{ secrets.REDDIT_CLIENT_ID }} | |
| REDDIT_SECRET: ${{ secrets.REDDIT_SECRET }} | |
| strategy: | |
| matrix: | |
| node-version: [20.x] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| - name: Install Deps | |
| run: npm i -g pnpm && pnpm install | |
| - name: Run Scrapper | |
| run: node scripts/scrapper.js | |
| - name: Commit Scrapper Output | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add . | |
| TIMESTAMP=$(TZ=Asia/Dhaka date '+%Y.%m.%d %H.%M GMT+6;') | |
| git commit -m "[dump,bot]: data dump at ${TIMESTAMP}" || echo "No changes to commit" | |
| - name: Push Changes | |
| run: git push | |
| - name: Trigger Generator Workflow | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| curl -X POST \ | |
| -H "Accept: application/vnd.github+json" \ | |
| -H "Authorization: Bearer $GITHUB_TOKEN" \ | |
| https://api.github.com/repos/${{ github.repository }}/dispatches \ | |
| -d '{"event_type":"scrapper_completed"}' |