mirror of
https://github.com/cmderdev/cmder.git
synced 2025-12-15 02:08:52 +08:00
Fix git reset logic in auto-merge error handling
Co-authored-by: DRSDavidSoft <4673812+DRSDavidSoft@users.noreply.github.com>
This commit is contained in:
7
.github/workflows/vendor.yml
vendored
7
.github/workflows/vendor.yml
vendored
@@ -137,7 +137,7 @@ jobs:
|
|||||||
|
|
||||||
# Commit the changes
|
# Commit the changes
|
||||||
git add vendor/sources.json
|
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
|
# Push directly to master
|
||||||
git push origin HEAD:master
|
git push origin HEAD:master
|
||||||
@@ -159,8 +159,11 @@ jobs:
|
|||||||
|
|
||||||
Write-Warning "Failed to auto-merge: $($_.Exception.Message)"
|
Write-Warning "Failed to auto-merge: $($_.Exception.Message)"
|
||||||
|
|
||||||
# Reset changes so PR creation can work
|
# Reset only if a commit was made (check if HEAD moved)
|
||||||
|
$headBeforeReset = git rev-parse HEAD
|
||||||
|
if ($commitResult) {
|
||||||
git reset --hard HEAD~1
|
git reset --hard HEAD~1
|
||||||
|
}
|
||||||
|
|
||||||
# Set flag to create PR instead
|
# Set flag to create PR instead
|
||||||
echo "AUTO_MERGED=false" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
|
echo "AUTO_MERGED=false" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
|
||||||
|
|||||||
Reference in New Issue
Block a user