Skip to content

Commit 8c5ac37

Browse files
committed
improve concurrent run handling
1 parent 070c08c commit 8c5ac37

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

action.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ runs:
318318
max_attempts=5
319319
attempt=1
320320
while true; do
321-
if git push --force-with-lease=coverage origin HEAD:coverage; then
321+
if git push origin HEAD:coverage; then
322322
break
323323
fi
324324
@@ -327,8 +327,14 @@ runs:
327327
exit 1
328328
fi
329329
330-
echo "Push rejected (attempt ${attempt}/${max_attempts}). Refreshing coverage branch..."
331-
git fetch origin coverage
330+
echo "Push rejected (attempt ${attempt}/${max_attempts}). Rebasing onto latest origin/coverage..."
331+
git fetch origin +refs/heads/coverage:refs/remotes/origin/coverage
332+
# Prefer this run's regenerated files if both runs touched the same paths.
333+
if ! git rebase -X theirs refs/remotes/origin/coverage; then
334+
git rebase --abort || true
335+
echo "Automatic rebase failed due to conflicts in coverage branch updates." >&2
336+
exit 1
337+
fi
332338
attempt=$(( attempt + 1 ))
333339
done
334340
else

0 commit comments

Comments
 (0)