Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Fix Update-DockerImageVariantsVersions to release only if all PRs were merged #92

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ function Update-DockerImageVariantsVersions {
if ($PR -and $AutoMergeQueue) {
# Error if any PR failed to merge
if ($autoMergeResults['FailCount']) {
$msg = "$( $autoMergeResults['FailCount'] ) PRs failed to merge. PRs: $( ($autoMergeResults['PRs'] | % { "#$_" }) -join ', ' )"
$msg = "$( $autoMergeResults['FailCount'] ) PRs failed to merge. PRs: $( ($autoMergeResults['FailPRNumbers'] | % { "#$_" }) -join ', ' )"
if ($ErrorActionPreference -eq 'Stop') {
throw $msg
}
Expand All @@ -138,20 +138,22 @@ function Update-DockerImageVariantsVersions {
if ($PSCmdlet.ShouldProcess("Result of merged PRs", 'return')) {
$autoMergeResults # Return the results
}

# Autorelease if all PRs merged
if ($AutoRelease) {
if ($autoMergeResults['AllPRs'] -and $autoMergeResults['FailCount'] -eq 0) {
"Will create a tagged release" | Write-Host -ForegroundColor Green
$tag = New-Release -TagConvention:$AutoReleaseTagConvention -WhatIf:$WhatIfPreference
if ($PSCmdlet.ShouldProcess("tag", 'return')) {
$tag
}
}
}
}elseif ($PR) {
if ($PSCmdlet.ShouldProcess("PRs", 'return')) {
,$prs # Return the PRs
}
}

# Autorelease if all PRs merged
if ($AutoRelease) {
"Will create a tagged release" | Write-Host -ForegroundColor Green
$tag = New-Release -TagConvention:$AutoReleaseTagConvention -WhatIf:$WhatIfPreference
if ($PSCmdlet.ShouldProcess("tag", 'return')) {
$tag
}
}
}catch {
if ($callerEA -eq 'Stop') {
throw
Expand Down