Download the file from SBI server, at 3:00 PM everyday #460
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
# .github/workflows/daily-download.yml | |
name: Download the file from SBI server, at 3:00 PM everyday | |
on: | |
schedule: | |
# Runs "at 4:40 PM and 10:40 PM IST time (i.e. 10:30 AM and 4:30 PM UTC)" (see https://crontab.guru) | |
- cron: "40 10,16 * * *" | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Download Rates FILE | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.10" | |
# libmagic is used to detect MIME type | |
- name: Install libmagic | |
run: | | |
sudo apt-get install -y libmagic1 | |
- name: Create and start virtual environment | |
run: | | |
python3 -m venv venv | |
source venv/bin/activate | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Download and save file | |
run: python main.py | |
- name: Get current time | |
uses: josStorer/get-current-time@v2.0.2 | |
id: current-time | |
with: | |
format: "dddd, MMMM Do YYYY, h:mm:ss a" | |
utcOffset: "+05:30" | |
# Commit the PDF and the updated rates in csv | |
- uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: "Auto Commit: SBI rates at ${{ steps.current-time.outputs.formattedTime }}" |