Skip to content

Explorer daily refresh #2

Explorer daily refresh

Explorer daily refresh #2

Workflow file for this run

# Daily refresh of relation tables from DVNS public API.
# Fail-closed: no commit if extract/validate/tests fail.
#
# Schedule: 01:00 UTC (before investigative-pipeline-dvns at 03:00 UTC).
name: Explorer daily refresh
on:
schedule:
- cron: "0 1 * * *"
workflow_dispatch:
inputs:
mode:
description: "full = all rows; smoke = max 30 rows for test"
required: false
default: "full"
type: choice
options:
- full
- smoke
skip_optional:
description: "Skip optional datasets (rinnovi)"
required: false
default: "false"
type: choice
options:
- "false"
- "true"
concurrency:
group: explorer-daily-refresh
cancel-in-progress: false
permissions:
contents: write
jobs:
refresh:
name: Extract + validate + commit relations
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run daily refresh
env:
SKIP_OPTIONAL: ${{ github.event.inputs.skip_optional == 'true' && '1' || '0' }}
run: |
chmod +x scripts/run_daily_refresh.sh
MODE="${{ github.event.inputs.mode || 'full' }}"
# schedule events have no inputs → full
if [ "${{ github.event_name }}" = "schedule" ]; then
MODE=full
fi
bash scripts/run_daily_refresh.sh "$MODE"
- name: Upload relations artifact
uses: actions/upload-artifact@v4
with:
name: explorer-relations-${{ github.run_id }}
path: |
data/relations/
data/processed/
retention-days: 14
- name: Commit updated relations (only if changed)
run: |
git config user.name "explorer-daily-bot"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add data/relations/ data/processed/
if git diff --staged --quiet; then
echo "No changes to commit (sources unchanged or identical output)."
exit 0
fi
git commit -m "chore(explorer): daily relations refresh $(date -u +%Y-%m-%d)"
git push