Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 0 additions & 55 deletions .github/workflows/clean-json.yml

This file was deleted.

6 changes: 6 additions & 0 deletions .github/workflows/refresh-data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ on:
- cron: '0 4 * * 1'
workflow_dispatch:

# All data workflows share one concurrency group so their pushes to main are
# serialized (queued, not cancelled) instead of racing.
concurrency:
group: flora-data-main
cancel-in-progress: false

permissions:
contents: write

Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/refresh-flora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ on:
- cron: '0 3 * * *'
workflow_dispatch:

# All data workflows share one concurrency group so their pushes to main are
# serialized (queued, not cancelled) instead of racing.
concurrency:
group: flora-data-main
cancel-in-progress: false

permissions:
contents: write

Expand Down Expand Up @@ -39,5 +45,6 @@ jobs:
echo "No changes to commit."
else
git commit -m "Daily FLoRA snapshot: $(date -u +'%Y-%m-%d %H:%M UTC')"
git pull --rebase origin main
git push
fi
42 changes: 35 additions & 7 deletions .github/workflows/refresh-impact-factor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,20 @@ name: Refresh Mean Citedness analysis (weekly)

on:
schedule:
# Monday 05:00 UTC, after the citation refresh
- cron: '0 5 * * 1'
# Monday 11:00 UTC. Deliberately several hours after refresh-data.yml
# (Monday 04:00 UTC, timeout 350 min = up to ~10:00 UTC) so that the
# long citation refresh has finished pushing to main before this job
# commits. Overlapping runs race their pushes to main and a rejected
# non-fast-forward push discards a whole run's output.
- cron: '0 11 * * 1'
workflow_dispatch:

# All data workflows share one concurrency group so their pushes to main are
# serialized (queued, not cancelled) instead of racing.
concurrency:
group: flora-data-main
cancel-in-progress: false

permissions:
contents: write

Expand All @@ -24,11 +34,29 @@ jobs:
- name: Install Python dependencies
run: pip install -r scripts/requirements.txt

- name: Refresh FLoRA snapshot
run: python scripts/refresh_flora.py
# The daily refresh-flora.yml keeps data/flora.csv fresh, so this job
# consumes the committed snapshot rather than re-downloading it here.
# Guard against that assumption failing silently: if the snapshot is
# older than 48h the daily job has been broken, and enriching stale
# input would publish a misleading fresh-timestamped analysis.
- name: Check FLoRA snapshot freshness
run: |
python - <<'EOF'
import json, sys
from datetime import datetime, timezone
stamp = json.load(open("data/flora_meta.json"))["last_updated"]
fetched = datetime.fromisoformat(stamp.replace("Z", "+00:00"))
age_h = (datetime.now(timezone.utc) - fetched).total_seconds() / 3600
print(f"flora.csv snapshot age: {age_h:.1f} h")
if age_h > 48:
sys.exit("flora.csv snapshot is stale (>48h) - fix refresh-flora.yml first")
EOF

- name: Enrich with OpenAlex Mean Citedness
continue-on-error: true
# No continue-on-error: if enrichment fails, flora_with_omc.csv is
# stale or missing, and the R render below would otherwise produce a
# "fresh" impact-factor analysis (new timestamp) from old data. Fail
# fast so nothing misleading gets committed.
env:
MY_EMAIL: ${{ secrets.MY_EMAIL }}
run: python scripts/compute_omc.py
Expand All @@ -46,13 +74,13 @@ jobs:
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add data/flora.csv data/flora_meta.json \
data/flora_with_omc.csv data/flora_with_omc_meta.json \
git add data/flora_with_omc.csv data/flora_with_omc_meta.json \
data/impact_factor_data.json data/impact_factor_meta.json \
cache/openalex_venues.json || true
if git diff --cached --quiet; then
echo "No changes to commit."
else
git commit -m "Mean Citedness refresh: $(date -u +'%Y-%m-%d %H:%M UTC')"
git pull --rebase origin main
git push
fi