Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions eng/setup-pr-validation.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,19 @@ try {
$remoteRef = git ls-remote origin refs/pull/$prNumber/head
Write-Host ($remoteRef | Out-String)

$prHeadSHA = $remoteRef.Split()[0]
if (!$prHeadSHA.StartsWith($commitSHA)) {
Write-Host "##vso[task.LogIssue type=error;]The PR's Head SHA ($prHeadSHA) does not begin with the specified commit SHA ($commitSHA). Unreviewed changes may have been pushed to the PR."
exit 1
}

Write-Host "Setting up the build for PR validation by merging refs/pull/$prNumber/merge into $sourceBranchName..."
git pull origin refs/pull/$prNumber/merge
if (!$?) {
Write-Host "##vso[task.LogIssue type=error;]Merging branch refs/pull/$prNumber/merge failed."
exit 1
}

Write-Host "Checking out the specified commit SHA ($commitSHA)..."
git checkout $commitSHA
if (!$?) {
Write-Host "##vso[task.LogIssue type=error;]Checking out commit SHA $commitSHA failed."
exit 1
}
}
catch {
Write-Host $_
Expand Down
Loading