Skip to content

paper-morning-digest #633

paper-morning-digest

paper-morning-digest #633

name: paper-morning-digest
on:
schedule:
# Run frequently; actual send timing is decided in app code via:
# TIMEZONE + SEND_HOUR + SEND_MINUTE + SEND_FREQUENCY.
- cron: "*/15 * * * *"
workflow_dispatch:
inputs:
os_runner:
description: "Runner OS"
required: true
default: "ubuntu-latest"
type: choice
options:
- ubuntu-latest
- windows-latest
- macos-latest
run_mode:
description: "Run mode"
required: true
default: "send_now"
type: choice
options:
- send_now
- dry_run
reason:
description: "Optional note for this run"
required: false
default: ""
type: string
permissions:
contents: read
concurrency:
group: paper-morning-digest
cancel-in-progress: false
jobs:
scheduled_send:
if: github.event_name == 'schedule'
runs-on: ubuntu-latest
env:
PAPER_DIGEST_ENV_PATH: ${{ github.workspace }}/ci_runtime/.env
PAPER_DIGEST_DATA_DIR: ${{ github.workspace }}/ci_runtime/data
PYTHONUTF8: "1"
TZ: UTC
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: python -m pip install --upgrade pip && pip install -r deps/requirements.txt
- name: Prepare runtime files from secrets
env:
PM_ENV_FILE: ${{ secrets.PM_ENV_FILE }}
PM_TOPICS_JSON: ${{ secrets.PM_TOPICS_JSON }}
PM_PROJECTS_JSON: ${{ secrets.PM_PROJECTS_JSON }}
PM_PROJECTS_FILE: config/projects.yaml
run: python scripts/gha_prepare_runtime.py
- name: Run digest (scheduled send_now)
run: python app/paper_digest_app.py --run-once
- name: Upload runtime logs
if: always()
uses: actions/upload-artifact@v4
with:
name: paper-morning-logs-schedule-${{ github.run_number }}
path: ci_runtime/data/
if-no-files-found: warn
retention-days: 7
manual_run:
if: github.event_name == 'workflow_dispatch'
runs-on: ${{ inputs.os_runner }}
env:
PAPER_DIGEST_ENV_PATH: ${{ github.workspace }}/ci_runtime/.env
PAPER_DIGEST_DATA_DIR: ${{ github.workspace }}/ci_runtime/data
PYTHONUTF8: "1"
TZ: UTC
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: python -m pip install --upgrade pip && pip install -r deps/requirements.txt
- name: Prepare runtime files from secrets
env:
PM_ENV_FILE: ${{ secrets.PM_ENV_FILE }}
PM_TOPICS_JSON: ${{ secrets.PM_TOPICS_JSON }}
PM_PROJECTS_JSON: ${{ secrets.PM_PROJECTS_JSON }}
PM_PROJECTS_FILE: config/projects.yaml
run: python scripts/gha_prepare_runtime.py
- name: Run digest (manual send_now)
if: inputs.run_mode == 'send_now'
run: python app/paper_digest_app.py --run-once
- name: Run digest (manual dry_run)
if: inputs.run_mode == 'dry_run'
run: python app/paper_digest_app.py --run-once --dry-run
- name: Upload runtime logs
if: always()
uses: actions/upload-artifact@v4
with:
name: paper-morning-logs-${{ inputs.os_runner }}-${{ github.run_number }}
path: ci_runtime/data/
if-no-files-found: warn
retention-days: 7