From e64c0b110d23223479c7a4ad8cd31a44882f2d9f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 8 Dec 2025 20:57:57 +0000 Subject: [PATCH] Fix git reset logic in auto-merge error handling Co-authored-by: DRSDavidSoft <4673812+DRSDavidSoft@users.noreply.github.com> --- .github/workflows/vendor.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/vendor.yml b/.github/workflows/vendor.yml index d1276bf..55e47f6 100644 --- a/.github/workflows/vendor.yml +++ b/.github/workflows/vendor.yml @@ -137,7 +137,7 @@ jobs: # Commit the changes git add vendor/sources.json - git commit -m "⬆️ Update dependencies ($env:LIST_UPDATED)" + $commitResult = git commit -m "⬆️ Update dependencies ($env:LIST_UPDATED)" # Push directly to master git push origin HEAD:master @@ -159,8 +159,11 @@ jobs: Write-Warning "Failed to auto-merge: $($_.Exception.Message)" - # Reset changes so PR creation can work - git reset --hard HEAD~1 + # Reset only if a commit was made (check if HEAD moved) + $headBeforeReset = git rev-parse HEAD + if ($commitResult) { + git reset --hard HEAD~1 + } # Set flag to create PR instead echo "AUTO_MERGED=false" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8