@@ -255,11 +255,23 @@ LogGroup 'Calculate Job Run Conditions:' {
255255 $hasPrereleaseLabel = ($prLabels | Where-Object { $prereleaseLabels -contains $_ }).Count -gt 0
256256 $isOpenOrLabeledPR = $isPR -and $pullRequestAction -in @ (' opened' , ' reopened' , ' synchronize' , ' labeled' )
257257
258- # Check if important files have changed in the PR
259- # Important files are determined by the configured ImportantFilePatterns setting
260- $hasImportantChanges = $false
258+ # Classify changed files for orchestration decisions.
259+ # Module-impacting files come from ImportantFilePatterns.
260+ # Docs-impacting files include module-impacting files plus docs/layout/config defaults.
261+ $hasModuleChanges = $false
262+ $hasDocsChanges = $false
263+ $modulePatterns = $settings.ImportantFilePatterns
264+ $docsOnlyPatterns = @ (
265+ ' ^docs/' ,
266+ ' ^\.github/zensical\.toml$' ,
267+ ' ^zensical\.toml$' ,
268+ ' ^mkdocs\.yml$' ,
269+ ' ^docs\.(ya?ml|json|toml)$'
270+ )
271+ $docsPatterns = @ ($modulePatterns + $docsOnlyPatterns | Select-Object - Unique)
272+
261273 if ($isPR -and $pullRequest.Number ) {
262- LogGroup ' Check for Important File Changes ' {
274+ LogGroup ' Classify Changed Files ' {
263275 $owner = $env: GITHUB_REPOSITORY_OWNER
264276 $repo = $env: GITHUB_REPOSITORY_NAME
265277 $prNumber = $pullRequest.Number
@@ -272,29 +284,35 @@ LogGroup 'Calculate Job Run Conditions:' {
272284 Write-Host " Changed files ($ ( $changedFiles.Count ) ):"
273285 $changedFiles | ForEach-Object { Write-Host " - $_ " }
274286
275- # Use configured important file patterns
276- $importantPatterns = $settings.ImportantFilePatterns
277-
278- # Check if any changed file matches an important pattern
287+ # Check module-impacting and docs-impacting patterns independently.
279288 foreach ($file in $changedFiles ) {
280- foreach ($pattern in $importantPatterns ) {
289+ foreach ($pattern in $modulePatterns ) {
290+ if ($file -match $pattern ) {
291+ $hasModuleChanges = $true
292+ Write-Host " Module-impacting file changed: [$file ] (matches pattern: $pattern )"
293+ break
294+ }
295+ }
296+
297+ foreach ($pattern in $docsPatterns ) {
281298 if ($file -match $pattern ) {
282- $hasImportantChanges = $true
283- Write-Host " Important file changed: [$file ] (matches pattern: $pattern )"
299+ $hasDocsChanges = $true
300+ Write-Host " Docs-impacting file changed: [$file ] (matches pattern: $pattern )"
284301 break
285302 }
286303 }
287- if ($hasImportantChanges ) { break }
304+
305+ if ($hasModuleChanges -and $hasDocsChanges ) { break }
288306 }
289307
290- if ($hasImportantChanges ) {
291- Write-Host ' ✓ Important files have changed - build/test stages will run'
308+ if ($hasModuleChanges ) {
309+ Write-Host ' ✓ Module-impacting files have changed - module build/test/release stages will run'
292310 } else {
293- Write-Host ' ✗ No important files changed - build/test stages will be skipped'
311+ Write-Host ' ✗ No module-impacting files changed - module build/test/release stages will be skipped'
294312
295- # Add a comment to open PRs explaining why build/test is skipped (best-effort, may fail if permissions not granted)
313+ # Add a comment to open PRs explaining why module stages are skipped (best-effort, may fail if permissions not granted)
296314 if ($isOpenOrUpdatedPR ) {
297- $patternRows = ($importantPatterns | ForEach-Object {
315+ $patternRows = ($modulePatterns | ForEach-Object {
298316 $escapedPattern = $_.Replace (' |' , ' \|' )
299317 $backtickMatches = [regex ]::Matches($escapedPattern , ' `+' )
300318 $maxRun = 0
@@ -305,15 +323,17 @@ LogGroup 'Calculate Job Run Conditions:' {
305323 " | ${codeDelimiter}${escapedPattern}${codeDelimiter} | Matches files where path matches this pattern |"
306324 }) -join " `n "
307325 $commentBody = @"
308- ### No Significant Changes Detected
326+ ### No Module-Impacting Changes Detected
309327
310- This PR does not contain changes to files that would trigger a new release:
328+ This PR does not contain changes to files that trigger module build/test/ release stages :
311329
312330| Pattern | Description |
313331| :--- | :---------- |
314332$patternRows
315333
316- **Build, test, and publish stages will be skipped** for this PR.
334+ **Module build, test, and release stages will be skipped** for this PR.
335+
336+ Documentation/site stages may still run when docs/layout/config files change.
317337
318338If you believe this is incorrect, please verify that your changes are in the correct locations.
319339"@
@@ -333,20 +353,21 @@ If you believe this is incorrect, please verify that your changes are in the cor
333353 }
334354 }
335355 } else {
336- # Not a PR event or no PR number - consider as having important changes (e.g., workflow_dispatch, schedule)
337- $hasImportantChanges = $true
338- Write-Host ' Not a PR event or missing PR number - treating as having important changes'
356+ # Not a PR event or no PR number - run both module and docs orchestration paths.
357+ $hasModuleChanges = $true
358+ $hasDocsChanges = $true
359+ Write-Host ' Not a PR event or missing PR number - treating as module/docs impacting changes'
339360 }
340361
341- # Prerelease requires both: prerelease label AND important file changes
362+ # Prerelease requires both: prerelease label AND module-impacting changes
342363 # No point creating a prerelease if only non-module files changed
343- $shouldPrerelease = $isOpenOrLabeledPR -and $hasPrereleaseLabel -and $hasImportantChanges
364+ $shouldPrerelease = $isOpenOrLabeledPR -and $hasPrereleaseLabel -and $hasModuleChanges
344365
345366 # Determine ReleaseType - what type of release to create
346367 # Values: 'Release', 'Prerelease', 'None'
347- # Release only happens when important files changed (actual module code/docs)
348- # Merged PRs without important changes should only trigger cleanup, not a new release
349- $releaseType = if ($isMergedPR -and $isTargetDefaultBranch -and $hasImportantChanges ) {
368+ # Release only happens when module-impacting files changed.
369+ # Merged PRs without module-impacting changes should only trigger cleanup, not a new release.
370+ $releaseType = if ($isMergedPR -and $isTargetDefaultBranch -and $hasModuleChanges ) {
350371 ' Release'
351372 } elseif ($shouldPrerelease ) {
352373 ' Prerelease'
@@ -365,7 +386,9 @@ If you believe this is incorrect, please verify that your changes are in the cor
365386 hasPrereleaseLabel = $hasPrereleaseLabel
366387 shouldPrerelease = $shouldPrerelease
367388 ReleaseType = $releaseType
368- HasImportantChanges = $hasImportantChanges
389+ HasImportantChanges = $hasModuleChanges
390+ HasModuleChanges = $hasModuleChanges
391+ HasDocsChanges = $hasDocsChanges
369392 } | Format-List | Out-String
370393}
371394
@@ -545,10 +568,10 @@ LogGroup 'Calculate Job Run Conditions:' {
545568 $settings.Publish.Module | Add-Member - MemberType NoteProperty - Name ReleaseType - Value $releaseType - Force
546569 $settings.Publish.Module.AutoCleanup = $shouldAutoCleanup
547570
548- # For open PRs, we only want to run build/test stages if important files changed .
549- # For merged PRs, workflow_dispatch, schedule - $hasImportantChanges is already true.
550- # Note: $shouldPrerelease already requires $hasImportantChanges, so no separate check needed.
551- $shouldRunBuildTest = $isNotAbandonedPR -and $hasImportantChanges
571+ # Route execution by change classification .
572+ $shouldRunModulePipeline = $isNotAbandonedPR -and $hasModuleChanges
573+ $shouldRunDocsPipeline = $isNotAbandonedPR -and $hasDocsChanges
574+ $docsNeedModuleBuild = $shouldRunDocsPipeline -and ( -not $settings .Build.Docs.Skip )
552575
553576 # Check if setup/teardown scripts exist in the repository
554577 $hasBeforeAllScript = Test-Path - Path ' tests/BeforeAll.ps1'
@@ -557,9 +580,9 @@ LogGroup 'Calculate Job Run Conditions:' {
557580 Write-Host " tests/BeforeAll.ps1 exists: $hasBeforeAllScript "
558581 Write-Host " tests/AfterAll.ps1 exists: $hasAfterAllScript "
559582
560- $sourceCodeEnabled = $shouldRunBuildTest -and ($null -ne $settings.Test.SourceCode.Suites )
561- $psModuleEnabled = $shouldRunBuildTest -and ($null -ne $settings.Test.PSModule.Suites )
562- $moduleLocalEnabled = $shouldRunBuildTest -and ($null -ne $settings.Test.Module.Suites )
583+ $sourceCodeEnabled = $shouldRunModulePipeline -and ($null -ne $settings.Test.SourceCode.Suites )
584+ $psModuleEnabled = $shouldRunModulePipeline -and ($null -ne $settings.Test.PSModule.Suites )
585+ $moduleLocalEnabled = $shouldRunModulePipeline -and ($null -ne $settings.Test.Module.Suites )
563586 $beforeAllEnabled = $moduleLocalEnabled -and $hasBeforeAllScript
564587 $afterAllEnabled = $moduleLocalEnabled -and $hasAfterAllScript
565588
@@ -575,12 +598,12 @@ LogGroup 'Calculate Job Run Conditions:' {
575598
576599 $settings.Build.Module | Add-Member - MemberType NoteProperty - Name Desired - Value (-not $settings.Build.Module.Skip ) - Force
577600 $settings.Build.Module | Add-Member - MemberType NoteProperty - Name Enabled - Value (
578- $shouldRunBuildTest -and (-not $settings.Build.Module.Skip )
601+ (-not $settings.Build.Module.Skip ) -and ( $shouldRunModulePipeline -or $docsNeedModuleBuild )
579602 ) - Force
580603 $settings.Build.Docs | Add-Member - MemberType NoteProperty - Name Desired - Value (-not $settings.Build.Docs.Skip ) - Force
581- $settings.Build.Docs | Add-Member - MemberType NoteProperty - Name Enabled - Value ($shouldRunBuildTest -and (-not $settings.Build.Docs.Skip )) - Force
604+ $settings.Build.Docs | Add-Member - MemberType NoteProperty - Name Enabled - Value ($shouldRunDocsPipeline -and (-not $settings.Build.Docs.Skip )) - Force
582605 $settings.Build.Site | Add-Member - MemberType NoteProperty - Name Desired - Value (-not $settings.Build.Site.Skip ) - Force
583- $settings.Build.Site | Add-Member - MemberType NoteProperty - Name Enabled - Value ($shouldRunBuildTest -and (-not $settings.Build.Site.Skip )) - Force
606+ $settings.Build.Site | Add-Member - MemberType NoteProperty - Name Enabled - Value ($shouldRunDocsPipeline -and (-not $settings.Build.Site.Skip )) - Force
584607
585608 $settings.Test.SourceCode | Add-Member - MemberType NoteProperty - Name Desired - Value (-not $settings.Test.SourceCode.Skip ) - Force
586609 $settings.Test.SourceCode | Add-Member - MemberType NoteProperty - Name Enabled - Value $sourceCodeEnabled - Force
@@ -593,28 +616,32 @@ LogGroup 'Calculate Job Run Conditions:' {
593616
594617 $settings.Test.TestResults | Add-Member - MemberType NoteProperty - Name Desired - Value (-not $settings.Test.TestResults.Skip ) - Force
595618 $settings.Test.TestResults | Add-Member - MemberType NoteProperty - Name Enabled - Value (
596- $shouldRunBuildTest -and (-not $settings.Test.TestResults.Skip ) -and (
619+ $shouldRunModulePipeline -and (-not $settings.Test.TestResults.Skip ) -and (
597620 ($null -ne $settings.Test.SourceCode.Suites ) -or ($null -ne $settings.Test.PSModule.Suites ) -or ($null -ne $settings.Test.Module.Suites )
598621 )
599622 ) - Force
600623 $settings.Test.CodeCoverage | Add-Member - MemberType NoteProperty - Name Desired - Value (-not $settings.Test.CodeCoverage.Skip ) - Force
601624 $settings.Test.CodeCoverage | Add-Member - MemberType NoteProperty - Name Enabled - Value (
602- $shouldRunBuildTest -and (-not $settings.Test.CodeCoverage.Skip ) -and (
625+ $shouldRunModulePipeline -and (-not $settings.Test.CodeCoverage.Skip ) -and (
603626 ($null -ne $settings.Test.PSModule.Suites ) -or ($null -ne $settings.Test.Module.Suites )
604627 )
605628 ) - Force
606629
607630 $settings.Publish.Module | Add-Member - MemberType NoteProperty - Name Desired - Value (($releaseType -ne ' None' ) -or $shouldAutoCleanup ) - Force
608631 $settings.Publish.Module | Add-Member - MemberType NoteProperty - Name Enabled - Value (($releaseType -ne ' None' ) -or $shouldAutoCleanup ) - Force
609632 $settings.Publish | Add-Member - MemberType NoteProperty - Name Site - Value ([pscustomobject ]@ {
610- Desired = $isMergedPR -and $isTargetDefaultBranch -and $hasImportantChanges
611- Enabled = $isMergedPR -and $isTargetDefaultBranch -and $hasImportantChanges
633+ Desired = $isMergedPR -and $isTargetDefaultBranch -and $hasDocsChanges
634+ Enabled = $isMergedPR -and $isTargetDefaultBranch -and $hasDocsChanges
612635 }) - Force
613636
614- $settings | Add-Member - MemberType NoteProperty - Name HasImportantChanges - Value $hasImportantChanges
637+ $settings | Add-Member - MemberType NoteProperty - Name HasImportantChanges - Value $hasModuleChanges - Force
638+ $settings | Add-Member - MemberType NoteProperty - Name HasModuleChanges - Value $hasModuleChanges - Force
639+ $settings | Add-Member - MemberType NoteProperty - Name HasDocsChanges - Value $hasDocsChanges - Force
615640
616641 Write-Host ' Phase execution state:'
617642 [pscustomobject ]@ {
643+ HasModuleChanges = $settings.HasModuleChanges
644+ HasDocsChanges = $settings.HasDocsChanges
618645 LintRepository = $settings.Linter.Repository.Enabled
619646 BuildModule = $settings.Build.Module.Enabled
620647 TestSourceCode = $settings.Test.SourceCode.Enabled
0 commit comments