diff --git a/eng/common/scripts/Delete-RemoteBranches.ps1 b/eng/common/scripts/Delete-RemoteBranches.ps1 index 77cf7e506..222f8562e 100644 --- a/eng/common/scripts/Delete-RemoteBranches.ps1 +++ b/eng/common/scripts/Delete-RemoteBranches.ps1 @@ -30,7 +30,9 @@ foreach ($branch in $branches) exit 1 } - if ($pullRequests -and (($pullRequests | ? { $_.State -eq "open" }).Count -eq 0)) + $openPullRequests = $pullRequests | ? { $_.State -eq "open" } + + if ($openPullRequests.Count -eq 0) { LogDebug "Branch [ $branchName ] in repo [ $RepoName ] has no associated open Pull Request. Deleting Branch" try{ diff --git a/eng/common/scripts/git-branch-push.ps1 b/eng/common/scripts/git-branch-push.ps1 index bc594a7e4..63abfa371 100644 --- a/eng/common/scripts/git-branch-push.ps1 +++ b/eng/common/scripts/git-branch-push.ps1 @@ -30,10 +30,7 @@ param( [string] $RemoteName = "azure-sdk-fork", [Parameter(Mandatory = $false)] - [boolean] $SkipCommit = $false, - - [Parameter(Mandatory = $false)] - [boolean] $AmendCommit = $false + [boolean] $SkipCommit = $false ) # This is necessay because of the janky git command output writing to stderr. @@ -69,14 +66,8 @@ if ($LASTEXITCODE -ne 0) } if (!$SkipCommit) { - if ($AmendCommit) { - Write-Host "git -c user.name=`"azure-sdk`" -c user.email=`"azuresdk@microsoft.com`" commit -am `"$($CommitMsg)`"" - git -c user.name="azure-sdk" -c user.email="azuresdk@microsoft.com" commit --amend -am "$($CommitMsg)" - } - else { - Write-Host "git -c user.name=`"azure-sdk`" -c user.email=`"azuresdk@microsoft.com`" commit --amend -am `"$($CommitMsg)`"" - git -c user.name="azure-sdk" -c user.email="azuresdk@microsoft.com" commit -am "$($CommitMsg)" - } + Write-Host "git -c user.name=`"azure-sdk`" -c user.email=`"azuresdk@microsoft.com`" commit --amend -am `"$($CommitMsg)`"" + git -c user.name="azure-sdk" -c user.email="azuresdk@microsoft.com" commit --amend -am "$($CommitMsg)" if ($LASTEXITCODE -ne 0) { Write-Error "Unable to add files and create commit LASTEXITCODE=$($LASTEXITCODE), see command output above."