From fe9e8418161ed19a84ef289c8fd1649039471aba Mon Sep 17 00:00:00 2001 From: bookerzhao Date: Tue, 4 Aug 2026 20:13:45 +0800 Subject: [PATCH] =?UTF-8?q?fix(ci):=20=F0=9F=9B=A1=EF=B8=8F=20use=20rsync?= =?UTF-8?q?=20--checksum=20for=20skills=20repo=20sync?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Align Push Skills Repo with the plugin-repo fix: content-based rsync, staged cached-diff detection, and HEAD version guardrail for same-size version bumps that previously yielded silent no-op syncs. Co-authored-by: Cursor --- .github/workflows/push-skills-repo.yaml | 26 ++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/.github/workflows/push-skills-repo.yaml b/.github/workflows/push-skills-repo.yaml index c02350695..ea43f44a6 100644 --- a/.github/workflows/push-skills-repo.yaml +++ b/.github/workflows/push-skills-repo.yaml @@ -63,22 +63,38 @@ jobs: done # 2. Copy generated output (rsync includes dotfiles; `cp src/*` drops them) - rsync -a ../.skills-repo-output/ . + # --checksum: version-only bumps often keep identical byte length (e.g. 2.25.5→2.25.6). + # Default size+mtime quick check can skip those when build output and checkout share a + # 1s mtime window, yielding porcelain=0 while skills HEAD stays behind. + rsync -a --checksum ../.skills-repo-output/ . - name: Commit and push changes env: SKILLS_REPO_TOKEN: ${{ secrets.SKILLS_REPO_TOKEN }} run: | + set -euo pipefail + cd skills-repo git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" # Configure git to use token for push git remote set-url origin https://x-access-token:${SKILLS_REPO_TOKEN}@github.com/TencentCloudBase/skills.git - - # Check if there are any changes - if [ -n "$(git status --porcelain)" ]; then - git add . + + # Stage first: git add hashes content and defeats racy-git false-clean status. + git add -A + + # Guardrail: compare build output vs committed HEAD (not WT after rsync). + SOURCE_WEB_VER=$(grep -E '^version:' "${{ github.workspace }}/.skills-repo-output/skills/web-development/SKILL.md" | head -1 | awk '{print $2}') + HEAD_WEB_VER=$(git show HEAD:skills/web-development/SKILL.md 2>/dev/null | grep -E '^version:' | head -1 | awk '{print $2}' || true) + STAGED_COUNT=$(git diff --cached --name-only | wc -l | tr -d ' ') + echo "web-development version source=${SOURCE_WEB_VER} skills_HEAD=${HEAD_WEB_VER} staged=${STAGED_COUNT}" + if [ -n "$SOURCE_WEB_VER" ] && [ -n "$HEAD_WEB_VER" ] && [ "$SOURCE_WEB_VER" != "$HEAD_WEB_VER" ] && [ "$STAGED_COUNT" = "0" ]; then + echo "::error::Skills sync staged no changes but web-development version diverges (skills HEAD ${HEAD_WEB_VER} -> source ${SOURCE_WEB_VER})." + exit 1 + fi + + if ! git diff --cached --quiet; then git commit -m "chore: sync skills from CloudBase-AI-ToolKit [skip ci]" git push else