fix(iterate-workflow): safer push logic with force-with-lease and rebase

This commit is contained in:
Youssef Aitousarrah 2026-04-08 10:49:45 -07:00
parent 527a56d922
commit c79e4c2bcb
1 changed files with 4 additions and 3 deletions

View File

@ -87,8 +87,9 @@ jobs:
--jq '.[0].number // empty') --jq '.[0].number // empty')
if [ -n "$EXISTING_PR" ]; then if [ -n "$EXISTING_PR" ]; then
git push origin HEAD:"$BRANCH" --force-with-lease 2>/dev/null || \ git fetch origin "$BRANCH" 2>/dev/null || true
git push origin HEAD:"$BRANCH" git pull --rebase origin main
git push origin HEAD:"$BRANCH" --force-with-lease
{ {
cat docs/iterations/LEARNINGS.md cat docs/iterations/LEARNINGS.md
echo "" echo ""
@ -99,7 +100,7 @@ jobs:
echo "Updated existing PR #${EXISTING_PR}" echo "Updated existing PR #${EXISTING_PR}"
else else
git checkout -b "$BRANCH" 2>/dev/null || git checkout "$BRANCH" git checkout -b "$BRANCH" 2>/dev/null || git checkout "$BRANCH"
git push -u origin "$BRANCH" git push -u origin "$BRANCH" --force-with-lease
{ {
cat docs/iterations/LEARNINGS.md cat docs/iterations/LEARNINGS.md
echo "" echo ""