Run Data2 Python script #191
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: Run Data2 Python script | |
on: | |
schedule: | |
- cron: '32 6 * * *' # 12:02 PM IST (06:32 AM UTC) | |
- cron: '10 10 * * *' # 03:40 PM IST (10:10 AM UTC) | |
- cron: '40 13 * * *' # 07:10 PM IST (01:40 PM UTC) | |
- cron: '10 16 * * *' # 09:40 PM IST (04:10 PM UTC) | |
workflow_dispatch: # Allow manual triggering of the workflow | |
jobs: | |
run_script: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.9' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install requests beautifulsoup4 | |
- name: Run Python script | |
env: | |
SIURL: ${{ secrets.SIURL }} | |
run: python data2.py | |
- name: Commit changes | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Actions" | |
git add data/data2.json || git commit -m "Create data2.json" | |
git commit -m "Update data2.json" || echo "No changes to commit" | |
git pull origin main || echo "No remote changes to pull" | |
git push origin main | |
- name: Push changes | |
uses: ad-m/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: main |