ci: serialize README regeneration pushes
Some checks are pending
Auto-Generate README / generate (push) Waiting to run

This commit is contained in:
shamanic 2026-06-12 06:31:27 +01:00
parent 741e5b7e0e
commit 25a9aac9d5

View file

@ -11,6 +11,10 @@ on:
permissions: permissions:
contents: write contents: write
concurrency:
group: auto-generate-readme-main
cancel-in-progress: false
jobs: jobs:
generate: generate:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -30,16 +34,36 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci
- name: Generate README - name: Generate and push README/registry
run: node scripts/generate-readme.js run: |
set -euo pipefail
- name: Generate registry JSON git config user.name "github-actions[bot]"
run: node scripts/export-json.js --pretty --output dist/registry.json git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Commit changes for attempt in 1 2 3 4 5; do
uses: stefanzweifel/git-auto-commit-action@v5 echo "Generation attempt ${attempt}"
with: git fetch origin main
commit_message: "docs: auto-regenerate README and registry data" git reset --hard origin/main
file_pattern: "README.md dist/registry.json"
commit_user_name: "github-actions[bot]" node scripts/generate-readme.js
commit_user_email: "41898282+github-actions[bot]@users.noreply.github.com" node scripts/export-json.js --pretty --output dist/registry.json
if git diff --quiet -- README.md dist/registry.json; then
echo "README.md and dist/registry.json are already current."
exit 0
fi
git add README.md dist/registry.json
git commit -m "docs: auto-regenerate README and registry data"
if git push origin HEAD:main; then
exit 0
fi
echo "Push raced with another main update; retrying..."
sleep 2
done
echo "Failed to push regenerated README/registry after retries" >&2
exit 1