Skip to content

Commit

Permalink
ci: Adjust CI Build for Doc-Only PRs validations
Browse files Browse the repository at this point in the history
  • Loading branch information
agneszitte committed Mar 27, 2024
1 parent d2eb75c commit 4274bc6
Showing 1 changed file with 34 additions and 6 deletions.
40 changes: 34 additions & 6 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
exclude:
- .github/
# don't trigger the CI if only docs files are changed
- doc/*
- '**/*.md'
# - doc/*
# - '**/*.md'

pr:
branches:
Expand All @@ -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.
Expand All @@ -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
Expand Down

0 comments on commit 4274bc6

Please sign in to comment.