-
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathprocess-pr-labels.yml
More file actions
33 lines (28 loc) · 1.06 KB
/
process-pr-labels.yml
File metadata and controls
33 lines (28 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Copyright (c) .NET Foundation and Contributors
# See LICENSE file in the project root for full license information.
steps:
- task: PowerShell@2
condition: succeeded()
displayName: Process PR labels
name: processPrLabels
env:
GITHUB_TOKEN: $(GitHubToken)
inputs:
targetType: 'inline'
script: |
# set default values
echo "##vso[task.setvariable variable=SKIP_UNIT_TESTS;isOutput=true]false"
# check if this is a PR
if($env:System_PullRequest_PullRequestNumber -eq $null)
{
Write-Host "Not building from PR. Nothing to do here."
exit 0
}
# get PR labels
$prLabels = gh pr view $env:System_PullRequest_PullRequestNumber --repo $env:BUILD_REPOSITORY_NAME --json labels --jq '.labels | .[].name'
# parse interesting labels
if($prLabels -match 'CI: Skip Unit Tests')
{
Write-Host "INFO: Found CI: Skip Unit Tests label"
echo "##vso[task.setvariable variable=SKIP_UNIT_TESTS;isOutput=true]true"
}