Skip to content

Commit 0e53645

Browse files
authored
Truncate long branch names created by Dependabot, causing build failure (#1788)
1 parent edf33a3 commit 0e53645

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ jobs:
8585
# Get the version suffix from the auto-incrementing build number. For example: '123' => 'master-00123'
8686
$revision = "{0:D5}" -f [convert]::ToInt32($env:GITHUB_RUN_NUMBER, 10)
8787
$branchName = ![string]::IsNullOrEmpty($env:GITHUB_HEAD_REF) ? $env:GITHUB_HEAD_REF : $env:GITHUB_REF_NAME
88-
$safeName = $branchName.Replace('/', '-').Replace('_', '-')
89-
$versionSuffix = "$safeName-$revision"
88+
$safeBranchName = $($branchName -Replace '[^a-zA-Z0-9-]', '-')[0..40] -Join ""
89+
$versionSuffix = "$safeBranchName-$revision"
9090
}
9191
Write-Output "Using version suffix: $versionSuffix"
9292
Write-Output "PACKAGE_VERSION_SUFFIX=$versionSuffix" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append

0 commit comments

Comments
 (0)