File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -167,6 +167,30 @@ if ("$Tag" -eq "")
167167 {
168168 return
169169 }
170+
171+ # It's possible that the dependency was updated to a pre-release version manually in which case we don't want to
172+ # roll back, even though it's not the latest version matching the configured pattern.
173+ try {
174+ if ([System.Management.Automation.SemanticVersion ]::Parse(($originalTag -replace ' ^v' , ' ' )) `
175+ -ge [System.Management.Automation.SemanticVersion ]::Parse(($latestTag -replace ' ^v' , ' ' )))
176+ {
177+ Write-Host " SemVer represented by the original tag '$originalTag ' is newer than the latest tag '$latestTag '. Skipping update."
178+ return
179+ }
180+ } catch {
181+ Write-Warning " Failed to parse semantic version '$value ': $_ "
182+ }
183+
184+ # Verify that the latest tag actually points to a different commit. Otherwise, we don't need to update.
185+ $refs = $ (git ls- remote -- tags $url )
186+ $refOriginal = (($refs -match " refs/tags/$originalTag " ) -split " [ \t]" ) | Select-Object - First 1
187+ $refLatest = (($refs -match " refs/tags/$latestTag " ) -split " [ \t]" ) | Select-Object - First 1
188+ if ($refOriginal -eq $refLatest )
189+ {
190+ Write-Host " Latest tag '$latestTag ' points to the same commit as the original tag '$originalTag '. Skipping update."
191+ return
192+ }
193+
170194 $Tag = $latestTag
171195}
172196
You can’t perform that action at this time.
0 commit comments