[patch] 优化提交检测合并逻辑

This commit is contained in:
2025-10-15 09:55:11 +08:00
parent 10cefc3c11
commit 340670742c

View File

@@ -515,10 +515,27 @@ jobs:
Write-Host "";
Write-Host "Step 5.2: Committing version changes...";
# Check if there are changes to commit
$hasUncommitted = git diff --quiet; $diffExitCode1 = $LASTEXITCODE;
$hasStagedChanges = git diff --staged --quiet; $diffExitCode2 = $LASTEXITCODE;
if (($diffExitCode1 -ne 0) -or ($diffExitCode2 -ne 0)) {
Write-Host "Detected uncommitted changes, creating commit...";
git commit -m "[skip ci] Update version to v$VERSION" --no-verify;
if ($LASTEXITCODE -eq 0) {
Write-Host "OK: Commit successful";
} else {
Write-Host "ERROR: Commit failed";
}
} else {
Write-Host "No changes to commit (already committed in merge)";
Write-Host "Skipping commit step";
$LASTEXITCODE = 0;
}
if ($LASTEXITCODE -eq 0) {
Write-Host "";
Write-Host "Step 5.3: Pushing to remote...";