API On GitHub Actions #677
This file contains hidden or 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: API On GitHub Actions | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "10 2 * * *" # Runs every day at 2:10 AM UTC | |
| jobs: | |
| API: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checking out repo | |
| uses: actions/checkout@v4 | |
| - name: Setting up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.9' | |
| - name: Installing package list | |
| run: apt list --installed | |
| # Need to fetch reqs if needed | |
| - name: Installing all necessary packages | |
| run: pip install -r requirements.txt | |
| - name: Running Python1 (Get stock data from FindMind and save to CSV) | |
| env: | |
| FINDMIND_GMAIL_TOKEN: ${{ secrets.FINDMIND_GMAIL_TOKEN }} | |
| run: | | |
| python FindMind-fetch_and_save_stock_data.py >output.log 2>&1 || true | |
| - name: Running Python2 (from CSV pick stock data by date) | |
| run: | | |
| python FindMind-read_stock_data_by_date.py >output2.log 2>&1 || true | |
| - name: Running Python3 (check the missing date by holiday.csv to check complete or not) | |
| run: | | |
| python create_holiday.py >output3.log 2>&1 || true | |
| - name: Running Python4,5,6 (from CSV pick Company features into `Features-Company.csv`) | |
| run: | | |
| python FindMind-read_PER_PBR.py >output4.log 2>&1 || true | |
| python FindMind-read_company-profile.py >output5.log 2>&1 || true | |
| python FindMind-read_dividend.py >output6.log 2>&1 || true | |
| - name: Commit and Push The Results From Python Action | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add *.csv | |
| git add *.log | |
| git add auction_data_processed/*.csv | |
| git add dividend/*.csv | |
| git add company-profile/*.csv | |
| git add PER_PBR/*.csv | |
| git add financial/*.csv | |
| git add stockdata/*.csv | |
| git add TWSE_TPEX/*.csv | |
| git commit -m "⬆️ GitHub Actions Results added" || true | |
| git push || true |