[patch] 优化提交检测合并逻辑
This commit is contained in:
@@ -515,10 +515,27 @@ jobs:
|
||||
|
||||
Write-Host "";
|
||||
Write-Host "Step 5.2: Committing version changes...";
|
||||
git commit -m "[skip ci] Update version to v$VERSION" --no-verify;
|
||||
|
||||
# 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 "OK: Commit successful";
|
||||
Write-Host "";
|
||||
Write-Host "Step 5.3: Pushing to remote...";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user