fix(autoupdate): skip a branch whose lockfile the default branch also changed

A lockfile changed on both sides merges as text and can come out broken,
so a tested merge differs from the merge that lands. Skip the branch and
let Renovate regenerate it on the next run.
This commit is contained in:
2026-10-05 11:11:27 +01:00
parent a0032ad2f8
commit 33fdaf6689
+15 -1
View File
@@ -337,7 +337,21 @@ jobs:
echo "::notice::$BRANCH is already in the default branch."
echo "skip=true" >> "$GITHUB_OUTPUT"
elif git merge --no-ff --no-commit FETCH_HEAD; then
echo "skip=false" >> "$GITHUB_OUTPUT"
# A lockfile that both sides changed merges as text and can be broken. Renovate regenerates it on the next run.
base=$(git merge-base HEAD FETCH_HEAD)
stale=""
for lock in pnpm-lock.yaml package-lock.json yarn.lock; do
for f in $(git ls-tree -r --name-only FETCH_HEAD | grep -E "(^|/)${lock//./\\.}$"); do
if ! git diff --quiet "$base" HEAD -- "$f" && ! git diff --quiet "$base" FETCH_HEAD -- "$f"; then stale="$stale $f"; fi
done
done
if [ -n "$stale" ]; then
git merge --abort
echo "::warning::$BRANCH and the default branch both changed${stale}. Renovate rebases it on the next run."
echo "skip=true" >> "$GITHUB_OUTPUT"
else
echo "skip=false" >> "$GITHUB_OUTPUT"
fi
else
git merge --abort
echo "::warning::$BRANCH conflicts with the default branch. Renovate rebases it on the next run."