From 4274bc6bee335e1b7bb4ae99d86a465e148040ba Mon Sep 17 00:00:00 2001 From: agneszitte Date: Wed, 27 Mar 2024 18:01:01 -0400 Subject: [PATCH] ci: Adjust CI Build for Doc-Only PRs validations --- azure-pipelines.yml | 40 ++++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index cf86ba553..2cac81980 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -13,8 +13,8 @@ exclude: - .github/ # don't trigger the CI if only docs files are changed - - doc/* - - '**/*.md' + # - doc/* + # - '**/*.md' pr: branches: @@ -31,8 +31,8 @@ pr: exclude: - .github/ # don't trigger the CI if only docs files are changed - - doc/* - - '**/*.md' + # - doc/* + # - '**/*.md' variables: # Path where packages (nuget or app packages) will be copied to. @@ -49,18 +49,46 @@ variables: # AndroidNdkDirectory: C:\Microsoft\AndroidNDK64\android-ndk-r16b stages: +- stage: DetermineChanges + jobs: + - job: EvaluateChanges + displayName: 'Check for Doc Only Changes' + pool: + vmImage: 'ubuntu-latest' + steps: + - powershell: | + $files = git diff HEAD HEAD~ --name-only + $docsOnly = $true + + foreach ($name in $files -split ' ') { + if (-not($name -like '*.md' -or $name -like '*/toc.yml')) { + $docsOnly = $false + break + } + } + + # Promote the docsOnly variable to a pipeline variable + Write-Host "##vso[task.setvariable variable=docsOnly;]$docsOnly" + - stage: Validations displayName: Validations + dependsOn: DetermineChanges + # Trigger this stage when docs files are changed + condition: eq(variables['docsOnly'], 'true') jobs: - template: build/stage-validations.yml - stage: Packages - dependsOn: Validations + dependsOn: DetermineChanges + # Don't trigger this stage if only docs files are changed + condition: ne(variables['docsOnly'], 'true') jobs: - template: build/stage-build-packages.yml - stage: Build_Samples - dependsOn: Validations + dependsOn: DetermineChanges + # Don't trigger this stage if only docs files are changed + condition: ne(variables['docsOnly'], 'true') jobs: - template: build/stage-build-ios.yml - template: build/stage-build-android.yml