Files
awesome-kubernetes/.github/workflows/05.1.readme_sync.yml
Nubenetes Bot b52f793ea5 ci: harden develop write-path against races & make PR Guardian advisory
Root cause of the recurring README-sync failure: 05.1 modified README.md in
earlier steps then ran `git pull`, which aborts on a dirty tree whenever a
concurrent bot commit advanced develop first. Rewrote its commit step as a
fetch → reset --hard → regenerate → commit → push retry loop (README is a pure
function of inventory, so a hard reset never loses data and eliminates the
merge-conflict / --ours/--theirs class entirely).

Also:
- 03.1/03.2/03.3: wrap the single-shot pull --rebase && push in a 5x retry loop.
- 07.1 PR Guardian: continue-on-error (advisory; keeps the comment, drops the
  blocking red  on AI false positives) + PR-scoped concurrency.
- 07.2 Markdown Linter: PR/branch-scoped concurrency with cancel-in-progress.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-19 19:06:10 +02:00

92 lines
3.2 KiB
YAML

name: 05.1. README Automated Sync
on:
push:
branches:
- develop
paths-ignore:
- 'README.md'
- 'data/inventory.yaml'
- '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@v6
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