Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save renevanosnabrugge/c54f22f3ed77d800e9a5c7f5a8539e1b to your computer and use it in GitHub Desktop.
Save renevanosnabrugge/c54f22f3ed77d800e9a5c7f5a8539e1b to your computer and use it in GitHub Desktop.
function Invoke-CheckSameCommitInBuild
{
$CurrentBuild = Get-BuildById -BuildId $currentBuildID
$builds = Get-BuildsByDefinition -BuildDefinitionID $CurrentBuild.definition[0].id
$LatestBuild = $builds.value | Where-Object {$_.result -eq "succeeded"} |Sort-Object {$_.finishtime} -Descending | select -First 1
if ($LatestBuild -eq $null)
{
#No successfull builds found, thus different commit"
Set-BuildTag -BuildID $currentBuildID -BuildTags "Release"
}
if ($LatestBuild.sourceVersion -ne $CurrentBuild.sourceVersion)
{
# Not the same, tag with a Release Tag
Set-BuildTag -BuildID $currentBuildID -BuildTags "Release"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment