Fix git reset logic in auto-merge error handling

Co-authored-by: DRSDavidSoft <4673812+DRSDavidSoft@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-12-08 20:57:57 +00:00
parent f2e8ae5189
commit e64c0b110d

View File

@@ -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