Fetch Dam Details #1878
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: Fetch Dam Details | |
on: | |
schedule: | |
- cron: '30 23 * * *' # 5:00 AM IST | |
- cron: '0 2 * * *' # 7:30 AM IST | |
- cron: '30 2 * * *' # 8:00 AM IST | |
- cron: '30 4 * * *' # 10:00 AM IST | |
- cron: '02 5 * * *' # 10:00 AM IST | |
- cron: '03 5 * * *' # 10:00 AM IST | |
- cron: '04 5 * * *' # 10:00 AM IST | |
- cron: '05 5 * * *' # 10:00 AM IST | |
- cron: '06 5 * * *' # 10:00 AM IST | |
- cron: '30 5 * * *' # 11:00 AM IST | |
- cron: '30 7 * * *' # 1:00 PM IST | |
- cron: '0 12 * * *' # 5:00 PM IST | |
- cron: '30 23 * * *' # 11:00 PM IST | |
# Why so many cron jobs for a once-a-day update ? | |
# Because its KSEB, trust their servers? hell no | |
workflow_dispatch: # Allow manual triggers | |
jobs: | |
fetch-dam-details: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
- name: Install dependencies | |
run: npm install axios cheerio | |
- name: Run dam details fetcher | |
run: node dam_details_fetcher.js | |
- name: Commit and push if changes | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add -A | |
git diff --quiet && git diff --staged --quiet || (git commit -m "Update dam details" && git push) |