Skip to content

Commit 966af0e

Browse files
committed
ci: bridge GitHub PRs to Azure DevOps for notifications
1 parent a71102b commit 966af0e

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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"

0 commit comments

Comments
 (0)