2023-11-14 23:26:05 +08:00
|
|
|
# yaml-language-server: $schema=https://raw.githubusercontent.com/microsoft/azure-pipelines-vscode/master/service-schema.json
|
|
|
|
jobs:
|
|
|
|
- job: Precheck
|
|
|
|
pool:
|
|
|
|
demands: ImageOverride -equals SHINE-VS17-Latest
|
|
|
|
${{ if eq(variables['System.CollectionUri'], 'https://dev.azure.com/ms/') }}:
|
|
|
|
name: SHINE-OSS-L
|
|
|
|
${{ if ne(variables['System.CollectionUri'], 'https://dev.azure.com/ms/') }}:
|
|
|
|
name: SHINE-INT-L
|
|
|
|
steps:
|
|
|
|
- checkout: none
|
|
|
|
|
|
|
|
- task: PowerShell@2
|
|
|
|
displayName: Verify Build Request
|
|
|
|
inputs:
|
|
|
|
targetType: 'inline'
|
|
|
|
script: |
|
2023-11-15 01:04:26 +08:00
|
|
|
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 = "$(system.pullRequest.sourceCommitId)";
|
|
|
|
$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) {
|
2023-11-14 23:26:05 +08:00
|
|
|
Write-Host '##vso[task.setvariable variable=skipBuild;isOutput=true]Yes'
|
|
|
|
Write-Host 'Skipping Build'
|
2023-11-15 01:04:26 +08:00
|
|
|
}
|
2023-11-14 23:26:05 +08:00
|
|
|
}
|
|
|
|
pwsh: true
|
2023-11-15 01:04:26 +08:00
|
|
|
name: verifyBuildRequest
|