Skip to content

Commit 77117a7

Browse files
Isolate analyzer reports and documentation artifacts
1 parent 105e4dc commit 77117a7

4 files changed

Lines changed: 44 additions & 27 deletions

File tree

.github/workflows/Build-Docs.yml

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -49,33 +49,6 @@ jobs:
4949
if-no-files-found: error
5050
retention-days: 1
5151

52-
- name: Commit all changes
53-
uses: PSModule/GitHub-Script@8083ec1f733f00357ee4d0db0c6056686e483bc0 # v1.9.0
54-
with:
55-
Debug: ${{ fromJson(inputs.Settings).Debug }}
56-
Prerelease: ${{ fromJson(inputs.Settings).Prerelease }}
57-
Verbose: ${{ fromJson(inputs.Settings).Verbose }}
58-
Version: ${{ fromJson(inputs.Settings).Version }}
59-
WorkingDirectory: ${{ fromJson(inputs.Settings).WorkingDirectory }}
60-
Script: |
61-
# Rename the gitignore file to .gitignore.bak
62-
if (Test-Path -Path .gitignore) {
63-
Rename-Item -Path '.gitignore' -NewName '.gitignore.bak' -Force
64-
}
65-
66-
try {
67-
# Add all changes to the repository
68-
git add .
69-
git commit -m 'Update documentation'
70-
} catch {
71-
Write-Host "No changes to commit"
72-
}
73-
74-
# Restore the gitignore file
75-
if (Test-Path -Path .gitignore.bak) {
76-
Rename-Item -Path '.gitignore.bak' -NewName '.gitignore' -Force
77-
}
78-
7952
- name: Lint documentation
8053
id: super-linter
8154
uses: super-linter/super-linter/slim@4ce20838b8ab83717e78138c5b3a1407148e0918 # v8.7.0

.github/workflows/Lint-SourceCode.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,5 @@ jobs:
3535
Path: src
3636
WorkingDirectory: ${{ fromJson(inputs.Settings).WorkingDirectory }}
3737
TestResult_Enabled: true
38+
TestResult_OutputPath: ${{ fromJson(inputs.Settings).WorkingDirectory }}/.PSModule/TestResult/PSModuleLint-SourceCode-${{ runner.os }}-TestResult-Report.xml
3839
TestResult_TestSuiteName: PSModuleLint-SourceCode-${{ runner.os }}

.github/workflows/Test-Module.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,5 @@ jobs:
7979
Verbose: ${{ fromJson(inputs.Settings).Verbose }}
8080
WorkingDirectory: ${{ fromJson(inputs.Settings).WorkingDirectory }}
8181
TestResult_Enabled: true
82+
TestResult_OutputPath: ${{ fromJson(inputs.Settings).WorkingDirectory }}/.PSModule/TestResult/PSModuleLint-Module-${{ runner.os }}-TestResult-Report.xml
8283
TestResult_TestSuiteName: PSModuleLint-Module-${{ runner.os }}

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

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,48 @@ jobs:
7676
persist-credentials: false
7777
fetch-depth: 0
7878

79+
- name: Verify generated artifacts remain isolated
80+
shell: pwsh
81+
run: |
82+
$expectedAnalyzerReportPaths = @{
83+
'.github/workflows/Test-Module.yml' = 'TestResult_OutputPath: ${{ fromJson(inputs.Settings).WorkingDirectory }}/.PSModule/TestResult/PSModuleLint-Module-${{ runner.os }}-TestResult-Report.xml'
84+
'.github/workflows/Lint-SourceCode.yml' = 'TestResult_OutputPath: ${{ fromJson(inputs.Settings).WorkingDirectory }}/.PSModule/TestResult/PSModuleLint-SourceCode-${{ runner.os }}-TestResult-Report.xml'
85+
}
86+
87+
foreach ($workflowPath in $expectedAnalyzerReportPaths.Keys) {
88+
$content = Get-Content -Path $workflowPath -Raw
89+
$expectedPath = $expectedAnalyzerReportPaths[$workflowPath]
90+
91+
if (-not $content.Contains($expectedPath)) {
92+
throw "Expected isolated analyzer report path was not found in $workflowPath."
93+
}
94+
}
95+
96+
$buildDocsWorkflow = Get-Content -Path '.github/workflows/Build-Docs.yml' -Raw
97+
$forbiddenStagingPatterns = @(
98+
'Rename-Item\s+-Path\s+[''"]\.gitignore[''"]'
99+
'git add \.'
100+
'PSModule/GitHub-Script'
101+
)
102+
103+
foreach ($pattern in $forbiddenStagingPatterns) {
104+
if ($buildDocsWorkflow -match $pattern) {
105+
throw "Build-Docs.yml must not use generated-artifact staging: $pattern"
106+
}
107+
}
108+
109+
$legacyArtifactPaths = @(
110+
'tests/srcTestRepo/TestResult'
111+
'tests/srcTestRepo/CodeCoverage'
112+
'tests/srcTestRepo/.temp'
113+
)
114+
115+
foreach ($path in $legacyArtifactPaths) {
116+
if (Test-Path -Path $path) {
117+
throw "Legacy root artifact path was created: $path"
118+
}
119+
}
120+
79121
- name: Download docs artifact
80122
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
81123
with:

0 commit comments

Comments
 (0)