hope this update work

This commit is contained in:
sankalp committed 2026-01-09 23:23:43 +05:45
1 parent 92b81971a9
commit 2a5fa047e1
1 file changed
+18 -19
+18 -19
View File
@@ -23,36 +23,35 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Set up Python
- name: Install Python 3.13
run: uv python install 3.13
- name: Determine current Nepali year and run scraper
run: |
set -e # Exit immediately if a command fails
MANUAL_YEAR="${{ github.event.inputs.year }}"
if [ -n "$MANUAL_YEAR" ]; then
echo "Using manually specified year: $MANUAL_YEAR"
uv run scraper.py $MANUAL_YEAR --dir
uv run python scraper.py "$MANUAL_YEAR" --dir
else
# Calculate current BS year (approximate logic for scheduling)
# BS year = AD year + 56 (for most months) or 57 (after mid-April)
python3 -c "
import datetime
now = datetime.datetime.now()
# Approx Nepali New Year is April 14
bs_year = now.year + 56
if now.month > 4 or (now.month == 4 and now.day >= 14):
bs_year += 1
print(bs_year)
" > bs_year.txt
BS_YEAR=$(cat bs_year.txt)
# Calculate approximate current BS year
BS_YEAR=$(python3 - << 'EOF'
import datetime
now = datetime.datetime.now()
bs_year = now.year + 56
if now.month > 4 or (now.month == 4 and now.day >= 14):
bs_year += 1
print(bs_year)
EOF
)
echo "Current Nepali Year (approx): $BS_YEAR"
# Run the scraper for the current year (and maybe the next to be safe)
uv run scraper.py $BS_YEAR --dir
# Run scraper for current and next year
uv run python scraper.py "$BS_YEAR" --dir
NEXT_YEAR=$((BS_YEAR + 1))
uv run scraper.py $NEXT_YEAR --dir
uv run python scraper.py "$NEXT_YEAR" --dir
fi
- name: Commit and push changes
@@ -60,5 +59,5 @@ jobs:
git config --global user.name "GitHub Action"
git config --global user.email "action@github.com"
git add data/
git commit -m "Automated update of Nepali calendar data" || exit 0
git diff-index --quiet HEAD || git commit -m "Automated update of Nepali calendar data"
git push