Skip to content

Update SDRF annotation for PXD049181 (#468) #293

Update SDRF annotation for PXD049181 (#468)

Update SDRF annotation for PXD049181 (#468) #293

name: Update README resource stats
on:
push:
branches: [main]
paths:
- "datasets/**"
- ".github/scripts/generate_readme_stats.py"
- ".github/workflows/update-readme-stats.yml"
workflow_dispatch:
# Dataset merges often land in a burst. Each push used to start its own job
# against the same reused chore/readme-resource-stats branch. create-pull-request
# then rebases an older stats commit onto a newer README/docs/stats snapshot
# and the standing PR stays conflicted (#266 / #265 race).
concurrency:
group: update-readme-resource-stats
cancel-in-progress: true
permissions:
contents: write
pull-requests: write
jobs:
refresh-stats:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
- name: Sync to latest main
run: |
git fetch origin main
git checkout main
git reset --hard origin/main
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install plotting dependency
run: pip install --upgrade matplotlib
- name: Generate README stats and plots
env:
MPLCONFIGDIR: /tmp/matplotlib
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
# Generation takes ~1–2 minutes. A standing stats PR can be merged
# in that window (#270 merged while the #269 job was still running,
# which then opened conflicted #271 from the pre-merge main tip).
# Rebuild from origin/main whenever it moves, and only publish the
# reused branch once HEAD still matches current main.
for attempt in 1 2 3; do
git fetch origin main
git checkout main
git reset --hard origin/main
base="$(git rev-parse HEAD)"
echo "Generating stats from ${base} (attempt ${attempt})"
python .github/scripts/generate_readme_stats.py
git fetch origin main
if [ "$(git rev-parse origin/main)" = "${base}" ]; then
echo "main still at ${base}; resetting chore/readme-resource-stats"
git push origin "HEAD:refs/heads/chore/readme-resource-stats" --force
exit 0
fi
echo "main moved to $(git rev-parse origin/main) during generation; retrying"
done
echo "main kept moving during stats generation" >&2
exit 1
- name: Open or update stats PR
uses: peter-evans/create-pull-request@22a9089034f40e5a961c8808d113e2c98fb63676 # v7.0.11
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore: refresh README resource stats"
branch: chore/readme-resource-stats
base: main
delete-branch: true
title: "chore: refresh README resource stats"
body: |
## Summary
Auto-generated resource snapshot from curated `datasets/**/*.sdrf.tsv`.
Updates only:
- `README.md` (Resource at a glance section)
- `docs/stats/**` (summary JSON + PNG plots)
Sandbox annotations are excluded.
add-paths: |
README.md
docs/stats/**
labels: |
automated
documentation