Tomorrow Prayer Times Update #500
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: Tomorrow Prayer Times Update | |
| on: | |
| schedule: | |
| # job is 3 minutes after midnight to allow the athan website to update the times before scraping it | |
| - cron: '3 5 * * *' # 5:03 AM UTC / 00:03 AM Toronto | |
| workflow_dispatch: # Allows manual triggering | |
| jobs: | |
| update_tomorrow_csv: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Full history checkout preserves all commits | |
| - name: Checkout Repository | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 # Ensure full commit history is fetched | |
| # Set up Python 3.13 with pip caching | |
| # Caching speeds up workflow by reusing dependencies | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.13' | |
| cache: 'pip' # Enables pip dependency caching | |
| # Create virtual environment and install dependencies | |
| # Isolation prevents conflicts between dependencies | |
| - name: Install Dependencies | |
| run: | | |
| python -m venv .venv | |
| source .venv/bin/activate | |
| pip install -r requirements.txt | |
| # Run scraper to fetch tomorrow's prayer times | |
| # Must be in virtual environment to access dependencies | |
| - name: Run Prayer Times Scraper | |
| run: | | |
| source .venv/bin/activate | |
| python python_scripts/scraper.py | |
| # Configure Git identity for automated commits | |
| - name: Configure Git | |
| run: | | |
| git config user.name "GitHub Actions" | |
| git config user.email "actions@github.com" | |
| # Update repository with new prayer times | |
| # Amends last commit instead of creating new one | |
| - name: Update Repository | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Required for push access | |
| run: | | |
| # Stage only the specific file | |
| git add data/prayer_times/tomorrow_prayer_times.csv | |
| # Amend last commit, preserving its message | |
| git commit --amend --no-edit | |
| # Force push with safety check | |
| git push -f origin main |