File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # PR validation pipeline for microsoft/rulesxp
2+ # - Triggered on GitHub pull requests targeting main
3+ # - Annotates the build name with PR metadata so ADO has access to this info.
4+
5+ trigger : none
6+
7+ pr :
8+ branches :
9+ include :
10+ - main
11+
12+ pool :
13+ vmImage : ubuntu-latest
14+
15+ steps :
16+ - powershell : |
17+ Write-Host "Build.Reason: $env:BUILD_REASON"
18+ Write-Host "PR number (GitHub): $env:SYSTEM_PULLREQUEST_PULLREQUESTNUMBER"
19+ Write-Host "From (source branch): $env:SYSTEM_PULLREQUEST_SOURCEBRANCH"
20+ Write-Host "To (target branch): $env:SYSTEM_PULLREQUEST_TARGETBRANCH"
21+ Write-Host "Repo: $env:BUILD_REPOSITORY_NAME"
22+
23+ # Compose a concise build name for email subjects / UI
24+ $status = if ($env:BUILD_REASON -eq 'PullRequest') { 'PR validation' } else { $env:BUILD_REASON }
25+ $prId = if ($env:SYSTEM_PULLREQUEST_PULLREQUESTNUMBER) { $env:SYSTEM_PULLREQUEST_PULLREQUESTNUMBER } else { 'n/a' }
26+ $commitMsg = $env:BUILD_SOURCEVERSIONMESSAGE
27+ if (-not [string]::IsNullOrEmpty($commitMsg) -and $commitMsg.Length -gt 60) {
28+ $commitMsg = $commitMsg.Substring(0,60) + '…'
29+ }
30+
31+ $buildName = "PR $prId - $status - $commitMsg"
32+ Write-Host "##vso[build.updatebuildnumber]$buildName"
33+ displayName: "Annotate build with PR metadata"
You can’t perform that action at this time.
0 commit comments