run_workflow #798
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_workflow | |
on: | |
schedule: | |
# Runs everyday at: | |
# 12:15 AM UTC (GMT0:00) -> 06:00 AM Nepal Time (GMT+5:45) | |
- cron: "15 00 * * *" | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checks-out this current repository | |
uses: actions/checkout@v3 | |
- name: Setup a specific version of python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Add new stocks or announcements and publish to telegram channel | |
env: | |
ALLOTMENT_URL: ${{ secrets.ALLOTMENT_URL }} | |
BOT_USERNAME: ${{ secrets.BOT_USERNAME }} | |
BOT_TOKEN: ${{ secrets.BOT_TOKEN }} | |
CHANNEL: ${{ secrets.CHANNEL }} | |
API_URL: ${{ secrets.API_URL }} | |
run: | | |
python run.py | |
- name: Commit only if new stocks have been added | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "stonksbot" | |
git diff --quiet || (git add nepstonks.db && git commit -m "🌱 db: add new stocks") | |
git push origin HEAD:main |