[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
This commit is contained in:
Jeremy Sinclair 2023-11-14 10:26:05 -05:00 committed by GitHub
parent 5e7d5d1f7f
commit 59a133b9e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 42 additions and 4 deletions

View File

@ -1744,6 +1744,7 @@ SETTINGCHANGE
SETTINGSCHANGED
settingsheader
settingshotkeycontrol
setvariable
SETWORKAREA
setzero
sfgao
@ -2143,6 +2144,7 @@ vsconfig
VSCROLL
vsetq
VSM
vso
vsonline
vstemplate
VSTHRD

View File

@ -1,3 +1,4 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/microsoft/azure-pipelines-vscode/main/service-schema.json
trigger:
batch: true
branches:
@ -9,21 +10,27 @@ trigger:
- doc/*
- temp/*
- tools/*
- '**.md'
pr:
branches:
include:
- main
- stable
paths:
exclude:
- '**.md'
- doc
# 0.0.yyMM.dd##
# 0.0.1904.0900
name: 0.0.$(Date:yyMM).$(Date:dd)$(Rev:rr)
jobs:
- template: ./templates/build-powertoys-precheck.yml
- template: ./templates/build-powertoys-ci.yml
parameters:
platform: x64
platform: x64
- template: ./templates/build-powertoys-ci.yml
parameters:
platform: arm64
platform: arm64

View File

@ -6,6 +6,8 @@ parameters:
jobs:
- job: Build${{ parameters.platform }}${{ parameters.configuration }}
displayName: Build ${{ parameters.platform }} ${{ parameters.configuration }}
dependsOn: Precheck
condition: and(succeeded(),ne(dependencies.Precheck.outputs['verifyBuildRequest.skipBuild'], 'Yes'))
variables:
BuildConfiguration: ${{ parameters.configuration }}
BuildPlatform: ${{ parameters.platform }}
@ -29,4 +31,4 @@ jobs:
# when we renamed our main branch.
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
displayName: 'Component Detection'
condition: and(succeededOrFailed(), not(eq(variables['Build.Reason'], 'PullRequest')))
condition: and(succeededOrFailed(), not(eq(variables['Build.Reason'], 'PullRequest')))

View File

@ -0,0 +1,27 @@
# 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