| | name: Daily Data Update |
| |
|
| | on: |
| | schedule: |
| | - cron: '0 12 * * *' |
| | workflow_dispatch: |
| |
|
| | jobs: |
| | update-and-commit: |
| | runs-on: ubuntu-latest |
| | permissions: |
| | contents: write |
| | steps: |
| | - name: Checkout repository |
| | uses: actions/checkout@v4 |
| |
|
| | - name: Set up Python |
| | uses: actions/setup-python@v4 |
| | with: |
| | python-version: '3.11' |
| |
|
| | - name: Install dependencies |
| | run: | |
| | pip install pandas requests |
| | |
| | - name: Run update script |
| | env: |
| | FINNHUB_KEY: ${{ secrets.FINNHUB_KEY }} |
| | run: python update_data.py |
| |
|
| | - name: Commit and push changes |
| | run: | |
| | git config --global user.name 'GitHub Action' |
| | git config --global user.email 'action@github.com' |
| | git add data/ai_sentiment.csv |
| | # Only commit if there are changes |
| | git diff --quiet && git diff --staged --quiet || (git commit -m "Daily data update [skip ci]" && git push) |
| | |