Files
awesome-kubernetes/.github/workflows/05.1.readme_sync.yml
Inaki Fernandez 7fa62edff3 ci: harden 05.1/07.1 against redundant push-triggered reruns [skip ci]
Two defense-in-depth follow-ups to the write-lock burst fix:

- 05.1 README Sync: add data/inventory.sql to paths-ignore, alongside the
  already-ignored data/inventory.yaml. It is a generated artifact, never
  hand-edited, so a push touching it should not wake the README sync.

- 07.1 PR Guardian: add [skip ci] to its auto-correction commit. Guardian
  pushes the fix back to the PR head branch, whose synchronize event otherwise
  re-runs Guardian (Gemini calls) and the markdown linter on Guardian's own
  cosmetic commit - exactly the CI minutes the workflow's concurrency comment
  says it wants to save. Base branches are unprotected, so no required check is
  stranded; human commits (no [skip ci]) still trigger Guardian normally.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-17 19:31:53 +02:00

93 lines
3.3 KiB
YAML

name: 05.1. README Automated Sync
on:
push:
branches:
- develop
paths-ignore:
- 'README.md'
- 'data/inventory.yaml'
- 'data/inventory.sql'
- 'docs/**'
- 'v2-docs/**'
workflow_dispatch: # Permite ejecución manual desde la pestaña Actions
permissions:
contents: write
concurrency:
group: develop-git-write-lock
cancel-in-progress: false
jobs:
sync-readme:
runs-on: ubuntu-latest
if: |
github.event_name == 'workflow_dispatch' || (
github.event.head_commit != null &&
!contains(github.event.head_commit.message, '[skip ci]') &&
!contains(github.event.head_commit.message, 'bot/v2-elite-sync') &&
!contains(github.event.head_commit.message, 'bot/knowledge-update')
)
steps:
- name: Repository Synchronization
uses: actions/checkout@v7
with:
fetch-depth: 0 # Full history for commit stats
- name: Python 3.11 Environment Provisioning
uses: actions/setup-python@v6
with:
python-version: '3.11'
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install pyyaml pytz python-dotenv
- name: Execute README Metric Updater
run: |
export PYTHONPATH=$PYTHONPATH:.
python src/readme_updater.py
- name: Validate README Integrity (Guardrail)
run: |
export PYTHONPATH=$PYTHONPATH:.
python src/safety_readme.py
- name: Commit and Push README Updates
run: |
git config --global user.name "Nubenetes Bot"
git config --global user.email "bot@nubenetes.com"
export PYTHONPATH=$PYTHONPATH:.
# README.md is a *pure function* of the inventory, so we never need to
# preserve a local README state: each attempt hard-resets to the freshest
# remote tip, regenerates, commits and pushes. This eliminates the two
# failure classes that previously broke this job:
# 1. Dirty-tree abort — the earlier steps modify README.md, then
# `git pull` aborted with "local changes would be overwritten by merge".
# 2. Merge/rebase --ours/--theirs confusion under concurrent bot pushes.
# A push can now only be rejected if the remote advanced between reset and
# push; we simply retry from the new tip. No conflict resolution required.
for i in {1..5}; do
echo "README sync attempt $i/5..."
git fetch origin develop
git reset --hard origin/develop
python src/readme_updater.py
python src/safety_readme.py
git add README.md
if git diff --staged --quiet; then
echo "README already in sync with inventory. Nothing to commit."
exit 0
fi
git commit -m "docs: automated README metric synchronization [skip ci]"
if git push origin develop; then
echo "Push succeeded on attempt $i."
exit 0
fi
echo "Attempt $i rejected — remote advanced, retrying from fresh tip..."
sleep $((i * 3))
done
echo "::error::README sync failed after 5 attempts (persistent write contention on develop)."
exit 1