fix: auto-resolve package-lock/badge/version conflicts in fork sync

The fork-sync and merge-forward workflows were failing on every run
because package-lock.json, package.json (version), and badge.svg
always conflict between upstream and forks. These are always safe to
take from upstream/main. Now auto-resolves these trivial conflicts
and only fails on real code conflicts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
gavrielc
2026-03-25 00:39:20 +02:00
parent 57e520c7e1
commit bf9b7d0311
2 changed files with 68 additions and 14 deletions

View File

@@ -52,10 +52,27 @@ jobs:
# Attempt merge
if ! git merge main --no-edit; then
echo "::warning::Merge conflict in $BRANCH"
git merge --abort
FAILED="$FAILED $SKILL_NAME"
continue
# Auto-resolve trivial conflicts
CONFLICTED=$(git diff --name-only --diff-filter=U)
CAN_AUTO=true
for f in $CONFLICTED; do
case "$f" in
package-lock.json|package.json|repo-tokens/badge.svg)
git checkout --theirs "$f"
git add "$f"
;;
*)
CAN_AUTO=false
;;
esac
done
if [ "$CAN_AUTO" = false ]; then
echo "::warning::Merge conflict in $BRANCH"
git merge --abort
FAILED="$FAILED $SKILL_NAME"
continue
fi
git commit --no-edit
fi
# Check if there's anything new to push