Skip to content

Commit 7ad7d26

Browse files
🩹 [Patch]: Action changes now trigger workflow validation and release checks (#401)
Workflow-only pull requests now behave correctly when the changed code lives in `.github/actions`, so action updates are validated and considered for release automation without manual workaround. ## Changed: Workflow test pipelines now include action-code changes The workflow test entry points now trigger on `.github/actions/**` changes in addition to workflow file changes, and action paths are treated as important artifacts in bump classification. ## Changed: Release workflow now runs when action files change The release workflow path filter now includes `.github/actions/**`, so action updates are not skipped by path-based gating. ## Fixed: Repo-linter class-file exclusions are scoped to the processed repository Super-linter exclusions are now expressed relative to the current repository working directory, which avoids path-handling issues in both default repository linting and test-repo linting scenarios. ## Fixed: Root-module relative path rendering is path-API based Root-module build comments now derive relative folder/file paths via `System.IO.Path` APIs instead of regex path replacement, which keeps region naming stable across path separators. ## Technical Details - Updated workflow path filters and important-file patterns in `Workflow-Test-Default.yml`, `Workflow-Test-WithManifest.yml`, and `Release.yml`. - Added scoped `FILTER_REGEX_EXCLUDE` values in `Linter.yml` and `Lint-Repository.yml`. - Reworked relative-path generation in `Add-ContentFromItem.ps1` and `Build-PSModuleRootModule.ps1` to use `GetRelativePath`, `ChangeExtension`, and separator-safe splitting. - Added/updated class-fixture files under `tests/srcTestRepo` and `tests/srcWithManifestTestRepo` for loader/linter coverage. <details> <summary>Related issues</summary> - PSModule/CurseForge#38 - PSModule/Template-PSModule#30 - PSModule/WoW#36 </details> --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 317bcb1 commit 7ad7d26

45 files changed

Lines changed: 497 additions & 195 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/actions/Build-PSModule/src/helpers/Build/Add-ContentFromItem.ps1‎

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function Add-ContentFromItem {
1+
function Add-ContentFromItem {
22
<#
33
.SYNOPSIS
44
Add the content of a folder or file to the root module file.
@@ -22,13 +22,10 @@
2222
[Parameter(Mandatory)]
2323
[string] $RootPath
2424
)
25-
# Get the path separator for the current OS
26-
$pathSeparator = [System.IO.Path]::DirectorySeparatorChar
25+
$separators = [char[]]@([System.IO.Path]::DirectorySeparatorChar, [System.IO.Path]::AltDirectorySeparatorChar)
2726

28-
$relativeFolderPath = $Path -replace $RootPath, ''
29-
$relativeFolderPath = $relativeFolderPath -replace $file.Extension, ''
30-
$relativeFolderPath = $relativeFolderPath.TrimStart($pathSeparator)
31-
$relativeFolderPath = $relativeFolderPath -split $pathSeparator | ForEach-Object { "[$_]" }
27+
$relativeFolderPath = [System.IO.Path]::GetRelativePath($RootPath, $Path)
28+
$relativeFolderPath = $relativeFolderPath.Split($separators, [System.StringSplitOptions]::RemoveEmptyEntries) | ForEach-Object { "[$_]" }
3229
$relativeFolderPath = $relativeFolderPath -join ' - '
3330

3431
Add-Content -Path $RootModuleFilePath -Force -Value @"
@@ -37,11 +34,11 @@ Write-Debug "[`$scriptName] - $relativeFolderPath - Processing folder"
3734
"@
3835

3936
$files = $Path | Get-ChildItem -File -Force -Filter '*.ps1' | Sort-Object -Property FullName
37+
4038
foreach ($file in $files) {
41-
$relativeFilePath = $file.FullName -replace $RootPath, ''
42-
$relativeFilePath = $relativeFilePath -replace $file.Extension, ''
43-
$relativeFilePath = $relativeFilePath.TrimStart($pathSeparator)
44-
$relativeFilePath = $relativeFilePath -split $pathSeparator | ForEach-Object { "[$_]" }
39+
$relativeFilePath = [System.IO.Path]::GetRelativePath($RootPath, $file.FullName)
40+
$relativeFilePath = [System.IO.Path]::ChangeExtension($relativeFilePath, $null).TrimEnd('.')
41+
$relativeFilePath = $relativeFilePath.Split($separators, [System.StringSplitOptions]::RemoveEmptyEntries) | ForEach-Object { "[$_]" }
4542
$relativeFilePath = $relativeFilePath -join ' - '
4643

4744
Add-Content -Path $RootModuleFilePath -Force -Value @"

‎.github/actions/Build-PSModule/src/helpers/Build/Build-PSModuleRootModule.ps1‎

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@
4848
[System.IO.DirectoryInfo] $ModuleOutputFolder
4949
)
5050

51-
# Get the path separator for the current OS
52-
$pathSeparator = [System.IO.Path]::DirectorySeparatorChar
51+
$separators = [char[]]@([System.IO.Path]::DirectorySeparatorChar, [System.IO.Path]::AltDirectorySeparatorChar)
5352

5453
Set-GitHubLogGroup 'Build root module' {
5554
$rootModuleFile = New-Item -Path $ModuleOutputFolder -Name "$ModuleName.psm1" -Force
@@ -185,22 +184,21 @@ Write-Debug "[$scriptName] - [data] - Done"
185184
)
186185

187186
foreach ($scriptFolder in $scriptFoldersToProcess) {
188-
$scriptFolder = Join-Path -Path $ModuleOutputFolder -ChildPath $scriptFolder
189-
if (-not (Test-Path -Path $scriptFolder)) {
187+
$scriptFolderPath = Join-Path -Path $ModuleOutputFolder -ChildPath $scriptFolder
188+
if (-not (Test-Path -Path $scriptFolderPath)) {
190189
continue
191190
}
192-
Add-ContentFromItem -Path $scriptFolder -RootModuleFilePath $rootModuleFile -RootPath $ModuleOutputFolder
193-
Remove-Item -Path $scriptFolder -Force -Recurse
191+
Add-ContentFromItem -Path $scriptFolderPath -RootModuleFilePath $rootModuleFile -RootPath $ModuleOutputFolder
192+
Remove-Item -Path $scriptFolderPath -Force -Recurse
194193
}
195194
#endregion - Add content from subfolders
196195

197196
#region - Add content from *.ps1 files on module root
198197
$files = $ModuleOutputFolder | Get-ChildItem -File -Force -Filter '*.ps1' | Sort-Object -Property FullName
199198
foreach ($file in $files) {
200-
$relativePath = $file.FullName -replace $ModuleOutputFolder, ''
201-
$relativePath = $relativePath -replace $file.Extension, ''
202-
$relativePath = $relativePath.TrimStart($pathSeparator)
203-
$relativePath = $relativePath -split $pathSeparator | ForEach-Object { "[$_]" }
199+
$relativePath = [System.IO.Path]::GetRelativePath($ModuleOutputFolder, $file.FullName)
200+
$relativePath = [System.IO.Path]::ChangeExtension($relativePath, $null).TrimEnd('.')
201+
$relativePath = $relativePath.Split($separators, [System.StringSplitOptions]::RemoveEmptyEntries) | ForEach-Object { "[$_]" }
204202
$relativePath = $relativePath -join ' - '
205203

206204
Add-Content -Path $rootModuleFile -Force -Value @"

‎.github/workflows/Lint-Repository.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ jobs:
5454
GITHUB_TOKEN: ${{ github.token }}
5555
DEFAULT_WORKSPACE: ${{ fromJson(env.Settings).WorkingDirectory }}
5656
FILTER_REGEX_INCLUDE: ${{ fromJson(env.Settings).WorkingDirectory }}
57+
FILTER_REGEX_EXCLUDE: ${{ fromJson(env.Settings).WorkingDirectory }}/src/classes/public/.*\.ps1$
5758
ENABLE_GITHUB_ACTIONS_STEP_SUMMARY: false
5859
SAVE_SUPER_LINTER_SUMMARY: true
5960

‎.github/workflows/Linter.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jobs:
2828
uses: super-linter/super-linter@4ce20838b8ab83717e78138c5b3a1407148e0918 # v8.7.0
2929
env:
3030
GITHUB_TOKEN: ${{ github.token }}
31+
FILTER_REGEX_EXCLUDE: 'tests/src(TestRepo|WithManifestTestRepo)/src/classes/public/.*\.ps1$'
3132
VALIDATE_BIOME_FORMAT: false
3233
VALIDATE_GITHUB_ACTIONS: false
3334
VALIDATE_JSCPD: false

‎.github/workflows/Release.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ on:
1313
- synchronize
1414
- labeled
1515
paths:
16+
- '.github/actions/**'
1617
- '.github/workflows/**'
1718
- '!.github/workflows/Release.yml'
1819
- '!.github/workflows/Linter.yml'

‎.github/workflows/Workflow-Test-Default.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
workflow_dispatch:
77
pull_request:
88
paths:
9+
- '.github/actions/**'
910
- '.github/workflows/**'
1011
- '!.github/workflows/Release.yml'
1112
- '!.github/workflows/Linter.yml'
@@ -43,4 +44,5 @@ jobs:
4344
ImportantFilePatterns: |
4445
^src/
4546
^README\.md$
47+
^\.github/actions/
4648
^\.github/workflows/(?!Release\.yml$|Linter\.yml$)

‎.github/workflows/Workflow-Test-WithManifest.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
workflow_dispatch:
77
pull_request:
88
paths:
9+
- '.github/actions/**'
910
- '.github/workflows/**'
1011
- '!.github/workflows/Release.yml'
1112
- '!.github/workflows/Linter.yml'
@@ -43,4 +44,5 @@ jobs:
4344
ImportantFilePatterns: |
4445
^src/
4546
^README\.md$
47+
^\.github/actions/
4648
^\.github/workflows/(?!Release\.yml$|Linter\.yml$)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class ActiveLoanRegister {
2+
[System.Collections.Generic.List[BookLoan]] $Loans
3+
4+
ActiveLoanRegister() {
5+
$this.Loans = [System.Collections.Generic.List[BookLoan]]::new()
6+
}
7+
8+
[void] AddLoan([BookLoan]$Loan) {
9+
$this.Loans.Add($Loan)
10+
}
11+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class AlphaCirculationNode {
2+
[string] $Id
3+
[ZetaCirculationNode] $Next
4+
5+
AlphaCirculationNode([string]$Id, [ZetaCirculationNode]$Next) {
6+
$this.Id = $Id
7+
$this.Next = $Next
8+
}
9+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class AuthorIndex {
2+
[string] $Name
3+
[AuthorProfile[]] $Authors
4+
[ZCatalog] $Catalog
5+
6+
AuthorIndex([string]$Name, [ZCatalog]$Catalog) {
7+
$this.Name = $Name
8+
$this.Catalog = $Catalog
9+
$this.Authors = @()
10+
}
11+
}

0 commit comments

Comments
 (0)