Skip to content

Daily Digest

Daily Digest #86

Workflow file for this run

name: Daily Digest
on:
schedule:
- cron: '30 9 * * 1-5' # UTC 09:30 = US pre-market morning, after New York has rolled into the trading day
workflow_dispatch: # manual trigger for testing
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
concurrency:
group: daily-digest-${{ github.ref }}
cancel-in-progress: false
jobs:
digest:
runs-on: ubuntu-latest
permissions:
contents: write # needed to git push
actions: write # needed to dispatch pages.yml after digest succeeds
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Configure git identity
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Sync latest branch
run: git pull --rebase origin ${{ github.ref_name }}
- name: Install dependencies
run: pip install -r requirements.txt
- name: Run daily pipeline
run: |
set -euxo pipefail
python -u main.py --mode daily 2>&1 | tee daily-pipeline.log
env:
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
API_NINJAS_KEY: ${{ secrets.API_NINJAS_KEY }}
FINNHUB_API_KEY: ${{ secrets.FINNHUB_API_KEY }}
SEC_USER_AGENT: ${{ secrets.SEC_USER_AGENT }}
LINNET_SEC_USER_AGENT: ${{ secrets.LINNET_SEC_USER_AGENT }}
PYTHONUNBUFFERED: "1"
# ── Optional delivery sinks ──────────────────────────────────
# Set these secrets in your repo to enable the corresponding sink.
# Leave unset (or empty) to skip that sink gracefully.
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SERVERCHAN_SENDKEY: ${{ secrets.SERVERCHAN_SENDKEY }}
- name: Upload daily pipeline log
if: always()
uses: actions/upload-artifact@v4
with:
name: daily-pipeline-log-${{ github.run_id }}
path: daily-pipeline.log
if-no-files-found: warn
- name: Commit and push outputs
run: |
# Generated JSON stays ignored locally, so CI force-adds it when publishing.
git add docs/
git add -f docs/data/
git diff --staged --quiet || git commit -m "digest: $(date -u +%Y-%m-%d)"
git pull --rebase -X ours origin ${{ github.ref_name }}
git push
- name: Trigger Pages publish
env:
GH_TOKEN: ${{ github.token }}
GH_API_URL: ${{ github.api_url }}
GH_REPOSITORY: ${{ github.repository }}
GH_REF_NAME: ${{ github.ref_name }}
run: |
curl --fail-with-body -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${GH_TOKEN}" \
"${GH_API_URL}/repos/${GH_REPOSITORY}/actions/workflows/pages.yml/dispatches" \
-d "{\"ref\":\"${GH_REF_NAME}\"}"