Daily Scraper #112
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: Daily Scraper | |
| on: | |
| schedule: | |
| - cron: '0 18 * * *' # Midnight Dhaka Time | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| scrape_and_commit: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # 1. Checkout Code | |
| - name: Checkout Code | |
| uses: actions/checkout@v3 | |
| # 2. Checkout Database (Into the 'public' folder) | |
| - name: Checkout Database | |
| uses: actions/checkout@v3 | |
| with: | |
| ref: database | |
| path: public | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.10' | |
| - name: Install Dependencies | |
| run: | | |
| pip install -r scraper/requirements.txt | |
| playwright install chromium | |
| - name: Run Scraper | |
| # This will write files into the 'public' folder | |
| run: python scraper/main.py | |
| - name: Commit and Push Data | |
| run: | | |
| # ENTER THE DATABASE BRANCH | |
| cd public | |
| git config --global user.name "DaamTrack Bot" | |
| git config --global user.email "bot@daamtrack.bd" | |
| # Add all new files in this branch | |
| git add . | |
| if git diff --staged --quiet; then | |
| echo "No changes to commit." | |
| else | |
| git commit -m "Daily Update: $(date +'%Y-%m-%d')" | |
| git push | |
| fi |