mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-11-24 12:25:12 +08:00
31 lines
1.3 KiB
YAML
31 lines
1.3 KiB
YAML
|
# yaml-language-server: $schema=https://raw.githubusercontent.com/microsoft/azure-pipelines-vscode/master/service-schema.json
|
||
|
jobs:
|
||
|
- job: Precheck
|
||
|
pool:
|
||
|
vmImage: windows-2022
|
||
|
steps:
|
||
|
- checkout: none
|
||
|
|
||
|
- pwsh: |-
|
||
|
try {
|
||
|
# Try based on pull request first
|
||
|
$pullRequestNumber = "$(system.pullRequest.pullRequestNumber)";
|
||
|
$gitHubPullRequest = Invoke-RestMethod -Method Get "https://api.github.com/repos/microsoft/PowerToys/pulls/$pullRequestNumber/files"
|
||
|
# If there are no files updated in the commit that are .md, set skipBuild variable
|
||
|
if(([array]($gitHubPullRequest.filename) -notmatch ".md|.txt").Length -eq 0) {
|
||
|
Write-Host '##vso[task.setvariable variable=skipBuild;isOutput=true]Yes'
|
||
|
Write-Host 'Skipping Build'
|
||
|
}
|
||
|
}
|
||
|
catch {
|
||
|
# Fall back to the latest commit otherwise.
|
||
|
$commit = "$(build.sourceVersion)";
|
||
|
$gitHubCommit = Invoke-RestMethod -Method Get "https://api.github.com/repos/microsoft/PowerToys/commits/$commit"
|
||
|
if(([array]($githubCommit.files.filename) -notmatch ".md|.txt").Length -eq 0) {
|
||
|
Write-Host '##vso[task.setvariable variable=skipBuild;isOutput=true]Yes'
|
||
|
Write-Host 'Skipping Build'
|
||
|
}
|
||
|
}
|
||
|
displayName: Verify whether we need to build at all
|
||
|
name: verifyBuildRequest
|