Skip to content

Commit 6d1ff47

Browse files
committed
Merge branch 'main' of https://github.com/nanoframework/nf-interpreter into develop
***NO_CI***
2 parents bcb2ba2 + 31b0012 commit 6d1ff47

File tree

1 file changed

+55
-54
lines changed

1 file changed

+55
-54
lines changed
Lines changed: 55 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,55 @@
1-
# Copyright (c) .NET Foundation and Contributors
2-
# See LICENSE file in the project root for full license information.
3-
4-
steps:
5-
- task: PowerShell@2
6-
name: Check_mscorlib_test
7-
displayName: Check mscorlib to test
8-
condition: ne(variables['System.PullRequest.PullRequestId'], '')
9-
inputs:
10-
failOnStderr: false
11-
targetType: "inline"
12-
script: |
13-
14-
# compute authorization header in format "AUTHORIZATION: basic 'encoded token'"
15-
# 'encoded token' is the Base64 of the string "nfbot:personal-token"
16-
$auth = "basic $([System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("nfbot:$(GitHubToken)")))"
17-
18-
# find PR
19-
"Getting PR#$env:System_PullRequest_PullRequestNumber details..." | Write-Host -ForegroundColor White -NoNewline
20-
$pr = Invoke-WebRequest "https://api.github.com/repos/$env:Build_Repository_Name/pulls/$env:System_PullRequest_PullRequestNumber" | ConvertFrom-Json
21-
22-
if($($pr.number) -eq "$env:System_PullRequest_PullRequestNumber")
23-
{
24-
'##[command] OK' | Write-Host -ForegroundColor Green
25-
}
26-
27-
# grab PR commit message
28-
$prCommitMessage = $($pr.body)
29-
30-
# look for test prompt in PR commit message
31-
# pattern is "Tested against nanoframework/CoreLibrary#NNNN"
32-
33-
if($prCommitMessage -match "Tested against nanoframework/CoreLibrary#(\d+)")
34-
{
35-
$testPR = $matches[1]
36-
"Test PR found: $testPR" | Write-Host -ForegroundColor White
37-
38-
# move to the build sources directory
39-
Set-Location -Path $(Agent.BuildDirectory)/s/CoreLibrary
40-
41-
# need to call this first to setup authentication
42-
gh auth setup-git
43-
44-
# gh auth status
45-
46-
Write-Host "Checking out mscorlib PR: #$testPR"
47-
gh pr checkout $testPR
48-
}
49-
else
50-
{
51-
"No test PR found. Using main branch" | Write-Host -ForegroundColor White
52-
}
53-
env:
54-
GITHUB_TOKEN: $(GitHubToken)
1+
# Copyright (c) .NET Foundation and Contributors
2+
# See LICENSE file in the project root for full license information.
3+
4+
steps:
5+
- task: PowerShell@2
6+
name: Check_mscorlib_test
7+
displayName: Check mscorlib to test
8+
condition: ne(variables['System.PullRequest.PullRequestId'], '')
9+
inputs:
10+
failOnStderr: false
11+
targetType: "inline"
12+
script: |
13+
14+
# compute authorization header in format "AUTHORIZATION: basic 'encoded token'"
15+
# 'encoded token' is the Base64 of the string "nfbot:personal-token"
16+
$auth = "basic $([System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("nfbot:$(GitHubToken)")))"
17+
18+
# find PR
19+
"Getting PR#$env:System_PullRequest_PullRequestNumber details..." | Write-Host -ForegroundColor White -NoNewline
20+
$pr = Invoke-RestMethod -Uri "https://api.github.com/repos/$env:Build_Repository_Name/pulls/$env:System_PullRequest_PullRequestNumber" -Header @{"Authorization"="$auth"} -ContentType "application/json" -Method GET
21+
22+
23+
if($($pr.number) -eq "$env:System_PullRequest_PullRequestNumber")
24+
{
25+
'##[command] OK' | Write-Host -ForegroundColor Green
26+
}
27+
28+
# grab PR commit message
29+
$prCommitMessage = $($pr.body)
30+
31+
# look for test prompt in PR commit message
32+
# pattern is "Tested against nanoframework/CoreLibrary#NNNN"
33+
34+
if($prCommitMessage -match "Tested against nanoframework/CoreLibrary#(\d+)")
35+
{
36+
$testPR = $matches[1]
37+
"Test PR found: $testPR" | Write-Host -ForegroundColor White
38+
39+
# move to the build sources directory
40+
Set-Location -Path $(Agent.BuildDirectory)/s/CoreLibrary
41+
42+
# need to call this first to setup authentication
43+
gh auth setup-git
44+
45+
# gh auth status
46+
47+
Write-Host "Checking out mscorlib PR: #$testPR"
48+
gh pr checkout $testPR
49+
}
50+
else
51+
{
52+
"No test PR found. Using main branch" | Write-Host -ForegroundColor White
53+
}
54+
env:
55+
GITHUB_TOKEN: $(GitHubToken)

0 commit comments

Comments
 (0)