🐛 fix(thirdparty): preserve manifest during snapshot update

This commit is contained in:
csh
2026-04-01 13:46:54 +08:00
parent 2e26f98687
commit 91b0ea7458
2 changed files with 31 additions and 4 deletions
+19 -4
View File
@@ -99,15 +99,30 @@ cd "$REPO_DIR"
git config user.name "$COMMIT_AUTHOR_NAME"
git config user.email "$COMMIT_AUTHOR_EMAIL"
git fetch origin "$TARGET_BRANCH"
git checkout -B "$TARGET_BRANCH" "origin/$TARGET_BRANCH"
tmp_dir="$(mktemp -d)"
cleanup() {
rm -rf "$tmp_dir"
}
trap cleanup EXIT
if [ ! -f "$MANIFEST_PATH" ]; then
echo "ERROR: third-party manifest not found: $MANIFEST_PATH" >&2
exit 1
fi
manifest_copy="$tmp_dir/thirdparty_skills.json"
cp "$MANIFEST_PATH" "$manifest_copy"
MANIFEST_PATH="$manifest_copy"
git fetch origin "$TARGET_BRANCH"
git checkout -B "$TARGET_BRANCH" "origin/$TARGET_BRANCH"
sources_file="$tmp_dir/sources.tsv"
if ! emit_sources_tsv > "$sources_file"; then
echo "ERROR: failed to load third-party manifest: $MANIFEST_PATH" >&2
exit 1
fi
changed=0
while IFS=$'\t' read -r source_id upstream_repo upstream_ref snapshot_dir sync_mode; do
[ -n "$source_id" ] || continue
@@ -167,7 +182,7 @@ EOF
git add -A "$snapshot_dir"
changed=1
done < <(emit_sources_tsv)
done < "$sources_file"
if [ "$changed" -eq 0 ] || git diff --cached --quiet; then
echo "All third-party snapshots are up to date."