PowerToys/.pipelines/ci/templates/build-powertoys-precheck.yml
Jeremy Sinclair 59a133b9e2
[ci]Exclude markdown file edits from triggering full build (#24418)
* Update ci.yml

Add path exclusions for markdown files.

* Update wildcard syntax

* Test edit SUPPORT.md

* Update ci.yml

* Test Update SUPPORT.md

* Update SUPPORT.md

Test update SUPPORT again.

* Update ci.yml

* Explicit define of markdown files at root

* Test update SUPPORT.md

* Update ci.yml

* Another Test Update SUPPORT.md

* Script to check existence of markdown changes in commit

* Added precheck job to determine whether a build needs to occur

* Added pool logic from ci-build to precheck

* Fixed GitHub API url for commits

* Test change to SUPPORT.md to see if logic works.

* Converted filename list to array to make notmatching criteria work

* Change to SUPPORT.md to test

* Updated condition to check success of previous precheck job

* Added task name to verifyBuildRequest and updated job run condition

* Another update to SUPPORT.md to test

* Updated spell-check

* Removed checkout step and made Powershell task inline

* Fixed indentation

* Test change to SUPPORT.md

* Fixing script

* Another test change to SUPPORT.md

* [CI] Update Build Precheck step to use latest agent config

* Update SUPPORT.md

* Update SUPPORT.md

* [CI] Update Build Precheck to exclude .txt and read changes from pull request

* [CI] Remove unneeded verifyBuildRequest script

* [CI] Updated variable names to reflect pull request retrieval in precheck
2023-11-14 15:26:05 +00:00

27 lines
1.1 KiB
YAML

# 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: |
$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'
}
pwsh: true
name: verifyBuildRequest