fix(ci): restore daily discovery workflow

- Add permissions: contents: write so git push works (was failing with 403)
- Add continue-on-error: true on discovery step so partial output still commits
- Change all commit/tracking/position steps to if: always() so they run regardless of discovery outcome
- Use commit-then-pull-rebase-then-push pattern to handle branch divergence
- Fix minervini scanner missing from scanners/__init__.py (enabled in config but never loaded)
- Fix .gitignore: results/* + !results/discovery/ so CI run logs can be committed

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Youssef Aitousarrah 2026-04-06 13:44:04 -07:00
parent 719a2d3f4e
commit 32d89c3bfc
3 changed files with 20 additions and 10 deletions

View File

@ -29,6 +29,8 @@ jobs:
runs-on: ubuntu-latest
environment: TradingAgent
timeout-minutes: 30
permissions:
contents: write
steps:
- name: Checkout repository
@ -55,6 +57,8 @@ jobs:
fi
- name: Run discovery pipeline
id: discovery
continue-on-error: true
env:
# LLM keys (set whichever provider you use)
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
@ -73,29 +77,31 @@ jobs:
--no-update-positions
- name: Commit recommendations to repo
if: always()
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# Stage new/updated recommendation files
# Stage new/updated recommendation and run-log files
git add data/recommendations/ || true
git add results/ || true
git add results/discovery/ || true
# Only commit if there are changes
if git diff --cached --quiet; then
echo "No new recommendations to commit"
else
git commit -m "chore: daily discovery ${{ steps.date.outputs.analysis_date }}"
git push
git pull --rebase origin ${{ github.ref_name }}
git push origin ${{ github.ref_name }}
fi
- name: Track recommendation performance
if: success()
if: always()
run: |
python scripts/track_recommendation_performance.py
- name: Commit performance updates
if: success()
if: always()
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
@ -104,18 +110,19 @@ jobs:
echo "No performance updates"
else
git commit -m "chore: update performance tracking ${{ steps.date.outputs.analysis_date }}"
git push
git pull --rebase origin ${{ github.ref_name }}
git push origin ${{ github.ref_name }}
fi
- name: Update positions
if: success()
if: always()
env:
FINNHUB_API_KEY: ${{ secrets.FINNHUB_API_KEY }}
run: |
python scripts/update_positions.py
- name: Commit position updates
if: success()
if: always()
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
@ -124,7 +131,8 @@ jobs:
echo "No position updates"
else
git commit -m "chore: update positions ${{ steps.date.outputs.analysis_date }}"
git push
git pull --rebase origin ${{ github.ref_name }}
git push origin ${{ github.ref_name }}
fi
- name: Upload results as artifact

3
.gitignore vendored
View File

@ -1,5 +1,6 @@
.venv
results
results/*
!results/discovery/
env/
__pycache__/
.DS_Store

View File

@ -6,6 +6,7 @@ from . import (
earnings_calendar, # noqa: F401
insider_buying, # noqa: F401
market_movers, # noqa: F401
minervini, # noqa: F401
ml_signal, # noqa: F401
options_flow, # noqa: F401
reddit_dd, # noqa: F401