Skip to content

Commit

Permalink
(build) Handle null value for PreReleaseLabel
Browse files Browse the repository at this point in the history
Depending on what branch is in play, the PreReleaseLabel may not
contain a value, as such, we need to handle when this hasn't been set,
and only attempt to grab a prerelease value when there is known to be
one.
  • Loading branch information
gep13 committed Jun 6, 2023
1 parent a543999 commit 7be1607
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion BuildScripts/default.ps1
Expand Up @@ -67,7 +67,9 @@ task Run-GitVersion {
# Having a pre-release label of greater than 10 characters can cause problems when trying to run choco pack.
# Since we typically only see this when building a local feature branch, or a PR, let's just trim it down to
# the 10 character limit, and move on.
$prerelease = $versionInfo.PreReleaseLabel.Replace("-","").Substring(0,10)
if ($versionInfo.PreReleaseLabel) {
$prerelease = $versionInfo.PreReleaseLabel.Replace("-","").Substring(0,10)
}

# Chocolatey doesn't support a prerelease that starts with a digit.
# If we see a digit here, merely replace it with an `a` to get around this.
Expand Down

0 comments on commit 7be1607

Please sign in to comment.