|
27 | 27 | steps: |
28 | 28 | - template: /eng/pipelines/templates/steps/workload-checkout.yml@self |
29 | 29 | parameters: |
30 | | - sourceBranch: source |
31 | | - engBranch: self |
| 30 | + sourceBranchAlias: source |
| 31 | + engBranchAlias: self |
| 32 | + # Sets the run name to use the source branch commit message. |
| 33 | + # Also, sets the OfficialBuildId variable to the original Build.BuildNumber for use in Arcade. |
| 34 | + # See: https://learn.microsoft.com/en-us/azure/devops/pipelines/process/run-number |
| 35 | + - powershell: | |
| 36 | + Write-Host "##vso[task.setvariable variable=OfficialBuildId]$(Build.BuildNumber)" |
| 37 | + # Keep only valid characters. Invalid characters include: " / : < > \ | ? @ * |
| 38 | + # Also, strip any trailing '.' characters as those are invalid too. |
| 39 | + $commitMessage = "$(git log -1 --pretty=%s)".Trim() -replace '["\/:<>\\|?@*]|\.{1,}$', '' |
| 40 | + # Lastly, truncate to 255 max characters: 241 = 255 - 14 (for build number and delimiter, ex: 20250910.13 • ) |
| 41 | + $commitMessage = $commitMessage.Substring(0, [Math]::Min($commitMessage.Length, 241)) |
| 42 | + Write-Host "##vso[build.updatebuildnumber]$(Build.BuildNumber) • $commitMessage" |
| 43 | + displayName: 🟣 Set run name via source branch commit message |
32 | 44 | - ${{ if eq(parameters.createVSInsertion, true) }}: |
33 | 45 | # The convertToJson expression in AzDO creates "pretty" JSON with line breaks and indentation. |
34 | 46 | # To simplify passing this JSON to scripts, we collapse it to a single line. |
|
71 | 83 | /p:DotNetSignType=$(_SignType) |
72 | 84 | /p:TeamName=$(_TeamName) |
73 | 85 | /p:DotNetPublishUsingPipelines=true |
74 | | - /p:OfficialBuildId=$(Build.BuildNumber) |
| 86 | + /p:OfficialBuildId=$(OfficialBuildId) |
75 | 87 | /p:StabilizePackageVersion=${{ parameters.stabilizePackageVersion }} |
76 | 88 | displayName: 🟣 Build solution |
77 | 89 | # Name is required to reference the variables created within this build step in other stages. |
|
0 commit comments