diff --git a/scripts/deploy.ps1 b/scripts/deploy.ps1 index 2355f8b..aac3dcd 100644 --- a/scripts/deploy.ps1 +++ b/scripts/deploy.ps1 @@ -75,8 +75,14 @@ try { if (-not $Message) { throw '-Commit 需要同时提供 -Message "提交说明"' } Write-Host '▶ 本地提交并推送 ...' -ForegroundColor Cyan & git add -A - & git commit -m $Message - if ($LASTEXITCODE -ne 0) { throw 'git commit 失败(可能没有改动)' } + & git diff --cached --quiet + if ($LASTEXITCODE -eq 0) { + Write-Host ' 没有待提交改动,跳过 commit' -ForegroundColor DarkGray + } + else { + & git commit -m $Message + if ($LASTEXITCODE -ne 0) { throw 'git commit 失败' } + } & git push origin main if ($LASTEXITCODE -ne 0) { throw 'git push 失败' }