Skip to content

Commit ea29e6b

Browse files
🚀[Feature]: Linting and Documentation Improvements with Conditional Summary Option (#226)
This pull request introduces improvements to the linting workflows and documentation, adds new configuration options for linter summary reporting, and updates test scripts for better visibility. The main focus is on allowing users to optionally display the super-linter summary even when no issues are found, and on clarifying documentation and prompts related to repository operations. **Workflow and Linter Enhancements:** * Added `ShowSummaryOnSuccess` option for both documentation and codebase linting workflows, allowing the super-linter summary to be displayed even on successful runs. Updated the workflows to post the summary conditionally based on this setting. (`.github/workflows/Build-Docs.yml`, `.github/workflows/workflow.yml`, [[1]](diffhunk://#diff-126bf89616b7daa3d14ebc882ad18666aaf1c3dae888c4ba306a66ec80758bc1R135-R155) [[2]](diffhunk://#diff-126bf89616b7daa3d14ebc882ad18666aaf1c3dae888c4ba306a66ec80758bc1R189) [[3]](diffhunk://#diff-7671544ba08199b4a27426300b58127b470b79b74ee36d823dacd165a01036eeR35-R39) [[4]](diffhunk://#diff-7671544ba08199b4a27426300b58127b470b79b74ee36d823dacd165a01036eeR104-L106) [[5]](diffhunk://#diff-7671544ba08199b4a27426300b58127b470b79b74ee36d823dacd165a01036eeR122-R136) * Extended the settings parsing logic to support the new `ShowSummaryOnSuccess` option for both `Build.Docs` and `Linter` configurations. (`.github/workflows/Get-Settings.yml`, [[1]](diffhunk://#diff-68f351d419a9b4db4797434891d5dfad44d83de65bfee7ba1c60badae369dbefR213) [[2]](diffhunk://#diff-68f351d419a9b4db4797434891d5dfad44d83de65bfee7ba1c60badae369dbefR236) **Documentation Updates:** * Updated `README.md` to document the new `ShowSummaryOnSuccess` options for both documentation and linter workflows, including example configuration and explanation of its usage. (`README.md`, [[1]](diffhunk://#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R252) [[2]](diffhunk://#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R265) [[3]](diffhunk://#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R280) [[4]](diffhunk://#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R338) [[5]](diffhunk://#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R426-R436) * Added a new section to `.github/copilot-instructions.md` for process-related Copilot instructions. **Prompt and Command Improvements:** * Clarified execution steps in `.github/prompts/pr.prompt.md` to specify changing directory to the root of the attached git folder, and updated references to GitHub MCP tool commands to use simplified names. [[1]](diffhunk://#diff-3f8b5491849b0980eb754bd1a7323ca0fbd2d76dee5d0ae0aad303f07768d291L27-R28) [[2]](diffhunk://#diff-3f8b5491849b0980eb754bd1a7323ca0fbd2d76dee5d0ae0aad303f07768d291L136-R139) **Test Script Output Improvements:** * Changed test setup and teardown scripts (`BeforeAll.ps1`, `AfterAll.ps1`) in both test repositories to use `Write-Warning` instead of `Write-Host` for better visibility of important messages. (`tests/srcTestRepo/tests/BeforeAll.ps1`, [[1]](diffhunk://#diff-194f79f552d669f15c73686eb90d586526eeee16a80ffe29c59dc5bd2697d77cL1-R2) [[2]](diffhunk://#diff-194f79f552d669f15c73686eb90d586526eeee16a80ffe29c59dc5bd2697d77cL11-R12); `tests/srcTestRepo/tests/AfterAll.ps1`, [[3]](diffhunk://#diff-cfa4b632600f9dd5021c13fd59ae56acc5beb93769f64e5837c2b1a4bfa6d181L1-R2) [[4]](diffhunk://#diff-cfa4b632600f9dd5021c13fd59ae56acc5beb93769f64e5837c2b1a4bfa6d181L11-R12); `tests/srcWithManifestTestRepo/tests/BeforeAll.ps1`, [[5]](diffhunk://#diff-4cc16ad5f540b198000f334246b4076322e9c2ecc00a8d5cd76a8d7f8f2d7cd4L1-R8); `tests/srcWithManifestTestRepo/tests/AfterAll.ps1`, [[6]](diffhunk://#diff-14dad688a5e209acb84a45277e1c27d98f241cbe994c8450450edfae4e2f6449L1-R8) --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 00488fd commit ea29e6b

File tree

10 files changed

+87
-27
lines changed

10 files changed

+87
-27
lines changed

.github/copilot-instructions.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# GitHub Copilot Instructions for Process-PSModule
2+
13
## Terminal Commands
24

35
When executing terminal commands (using `run_in_terminal` or similar tools):

.github/prompts/pr.prompt.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ $ARGUMENTS
2424

2525
## Execution Steps
2626

27-
0. Change directory to the repository root if not already there.
27+
0. If a folder is **explicitly attached to this chat** (“references”), you **must** change directory to the root of the git folder it is in. If there are no git folders you can change to the provided folder.
28+
2829
1. **Detect repository mode**:
2930
- Run `git remote -v` to check configured remotes.
3031
- **If `upstream` remote exists**: Fork mode
@@ -133,9 +134,9 @@ $ARGUMENTS
133134
- Set PR to target the default branch (main/master) of the target repository
134135
- Open as a **draft PR** (or keep as draft if updating)
135136
- **Use GitHub MCP tools** to perform these operations in the **target repository**:
136-
- Create PR (if not exists) - owner/repo should be target repository, use `mcp_github_github_create_pull_request`
137-
- Update PR (if exists) - owner/repo should be target repository, use `mcp_github_github_update_pull_request`
138-
- Add labels to PR - owner/repo should be target repository, use `mcp_github_github_add_labels_to_issue` (PRs are issues in GitHub API)
137+
- Create PR (if not exists) - owner/repo should be target repository, use `create_pull_request`
138+
- Update PR (if exists) - owner/repo should be target repository, use `update_pull_request`
139+
- Add labels to PR - owner/repo should be target repository, use `update_issue` (PRs are issues in GitHub API)
139140

140141
8. **Apply labels to the PR**:
141142
- Add the **change type label** based on the type specified (Major, Minor, Patch, Fix, or Docs)

.github/workflows/Build-Docs.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ on:
3232
description: The working directory where the script will run from.
3333
required: false
3434
default: '.'
35+
ShowSummaryOnSuccess:
36+
type: boolean
37+
description: Whether to show the super-linter summary on success.
38+
required: false
39+
default: false
3540

3641
permissions:
3742
contents: read # to checkout the repo
@@ -96,14 +101,15 @@ jobs:
96101
}
97102
98103
- name: Lint documentation
104+
id: super-linter
99105
uses: super-linter/super-linter/slim@7bba2eeb89d01dc9bfd93c497477a57e72c83240 # v8.2.0
100106
env:
101-
FILTER_REGEX_INCLUDE: outputs/docs
107+
RUN_LOCAL: true
102108
DEFAULT_BRANCH: main
103109
DEFAULT_WORKSPACE: ${{ inputs.WorkingDirectory }}
110+
FILTER_REGEX_INCLUDE: ${{ inputs.WorkingDirectory }}/outputs/docs
104111
ENABLE_GITHUB_ACTIONS_GROUP_TITLE: true
105112
GITHUB_TOKEN: ${{ github.token }}
106-
RUN_LOCAL: true
107113
VALIDATE_ALL_CODEBASE: true
108114
VALIDATE_BIOME_FORMAT: false
109115
VALIDATE_BIOME_LINT: false
@@ -113,3 +119,18 @@ jobs:
113119
VALIDATE_JSON_PRETTIER: false
114120
VALIDATE_MARKDOWN_PRETTIER: false
115121
VALIDATE_YAML_PRETTIER: false
122+
ENABLE_GITHUB_ACTIONS_STEP_SUMMARY: false
123+
SAVE_SUPER_LINTER_SUMMARY: true
124+
125+
- name: Post super-linter summary
126+
if: failure() || inputs.ShowSummaryOnSuccess == true
127+
shell: pwsh
128+
run: |
129+
$summaryPath = Join-Path $env:GITHUB_WORKSPACE 'super-linter-output' 'super-linter-summary.md'
130+
Get-Content $summaryPath | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8
131+
132+
$failed = '${{ steps.super-linter.outcome }}' -eq 'failure'
133+
if ($failed) {
134+
Write-Host "::error::Super-linter found issues. Please review the summary above."
135+
exit 1
136+
}

.github/workflows/Get-Settings.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ jobs:
209209
Skip = $settings.Build.Module.Skip ?? $false
210210
}
211211
Docs = [pscustomobject]@{
212-
Skip = $settings.Build.Docs.Skip ?? $false
212+
Skip = $settings.Build.Docs.Skip ?? $false
213+
ShowSummaryOnSuccess = $settings.Build.Docs.ShowSummaryOnSuccess ?? $false
213214
}
214215
Site = [pscustomobject]@{
215216
Skip = $settings.Build.Site.Skip ?? $false
@@ -231,8 +232,9 @@ jobs:
231232
232233
}
233234
Linter = [pscustomobject]@{
234-
Skip = $settings.Linter.Skip ?? $false
235-
env = $settings.Linter.env ?? @{}
235+
Skip = $settings.Linter.Skip ?? $false
236+
ShowSummaryOnSuccess = $settings.Linter.ShowSummaryOnSuccess ?? $false
237+
env = $settings.Linter.env ?? @{}
236238
}
237239
}
238240
LogGroup "Final settings" {

.github/workflows/workflow.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,27 @@ jobs:
132132
}
133133
134134
- name: Lint code base
135+
id: super-linter
135136
uses: super-linter/super-linter@7bba2eeb89d01dc9bfd93c497477a57e72c83240 # v8.2.0
136137
env:
137138
GITHUB_TOKEN: ${{ github.token }}
139+
DEFAULT_WORKSPACE: ${{ inputs.WorkingDirectory }}
140+
FILTER_REGEX_INCLUDE: ${{ inputs.WorkingDirectory }}
141+
ENABLE_GITHUB_ACTIONS_STEP_SUMMARY: false
142+
SAVE_SUPER_LINTER_SUMMARY: true
143+
144+
- name: Post super-linter summary
145+
if: failure() || fromJson(needs.Get-Settings.outputs.Settings).Linter.ShowSummaryOnSuccess == true
146+
shell: pwsh
147+
run: |
148+
$summaryPath = Join-Path $env:GITHUB_WORKSPACE 'super-linter-output' 'super-linter-summary.md'
149+
Get-Content $summaryPath | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8
150+
151+
$failed = '${{ steps.super-linter.outcome }}' -eq 'failure'
152+
if ($failed) {
153+
Write-Host "::error::Super-linter found issues. Please review the summary above."
154+
exit 1
155+
}
138156
139157
# Runs on:
140158
# - ✅ Open/Updated PR - Builds module for testing
@@ -168,6 +186,7 @@ jobs:
168186
Verbose: ${{ inputs.Verbose }}
169187
Version: ${{ inputs.Version }}
170188
WorkingDirectory: ${{ inputs.WorkingDirectory }}
189+
ShowSummaryOnSuccess: ${{ fromJson(needs.Get-Settings.outputs.Settings).Build.Docs.ShowSummaryOnSuccess }}
171190

172191
# Runs on:
173192
# - ✅ Open/Updated PR - Builds site for preview

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ The following settings are available in the settings file:
249249
| `Build.Skip` | `Boolean` | Skip all build tasks | `false` |
250250
| `Build.Module.Skip` | `Boolean` | Skip module build | `false` |
251251
| `Build.Docs.Skip` | `Boolean` | Skip documentation build | `false` |
252+
| `Build.Docs.ShowSummaryOnSuccess` | `Boolean` | Show super-linter summary on success for documentation linting | `false` |
252253
| `Build.Site.Skip` | `Boolean` | Skip site build | `false` |
253254
| `Publish.Module.Skip` | `Boolean` | Skip module publishing | `false` |
254255
| `Publish.Module.AutoCleanup` | `Boolean` | Automatically cleanup old prerelease module versions | `true` |
@@ -261,6 +262,7 @@ The following settings are available in the settings file:
261262
| `Publish.Module.PatchLabels` | `String` | Labels indicating a patch version bump | `'patch, fix'` |
262263
| `Publish.Module.IgnoreLabels` | `String` | Labels indicating no release | `'NoRelease'` |
263264
| `Linter.Skip` | `Boolean` | Skip repository linting | `false` |
265+
| `Linter.ShowSummaryOnSuccess` | `Boolean` | Show super-linter summary on success for repository linting | `false` |
264266
| `Linter.env` | `Object` | Environment variables for super-linter configuration | `{}` |
265267

266268
<details>
@@ -275,6 +277,7 @@ Build:
275277
Skip: false
276278
Docs:
277279
Skip: false
280+
ShowSummaryOnSuccess: false
278281
Site:
279282
Skip: false
280283
@@ -332,6 +335,7 @@ Publish:
332335
333336
Linter:
334337
Skip: false
338+
ShowSummaryOnSuccess: false
335339
env: {}
336340
337341
```
@@ -419,6 +423,17 @@ Linter:
419423
VALIDATE_ALL_CODEBASE: false
420424
```
421425

426+
#### Showing Linter Summary on Success
427+
428+
By default, the linter only shows a summary when it finds issues. You can enable summary display on successful runs:
429+
430+
```yaml
431+
Linter:
432+
ShowSummaryOnSuccess: true
433+
```
434+
435+
This is useful for reviewing what was checked even when no issues are found.
436+
422437
**Note:** The `GITHUB_TOKEN` is automatically provided by the workflow to enable status updates in pull requests.
423438

424439
For a complete list of available environment variables and configuration options, see the
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Write-Host "=== AFTERALL TEARDOWN SCRIPT EXECUTING ==="
2-
Write-Host "Tearing down test environment..."
1+
Write-Warning "=== AFTERALL TEARDOWN SCRIPT EXECUTING ==="
2+
Write-Warning "Tearing down test environment..."
33

44
# Example teardown tasks:
55
# - Clean up test infrastructure
@@ -8,5 +8,5 @@ Write-Host "Tearing down test environment..."
88
# - Drop test databases
99
# - Stop test services
1010

11-
Write-Host "Test environment teardown completed successfully!"
12-
Write-Host "=== AFTERALL TEARDOWN SCRIPT COMPLETED ==="
11+
Write-Warning "Test environment teardown completed successfully!"
12+
Write-Warning "=== AFTERALL TEARDOWN SCRIPT COMPLETED ==="
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Write-Host "=== BEFOREALL SETUP SCRIPT EXECUTING ==="
2-
Write-Host "Setting up test environment..."
1+
Write-Warning "=== BEFOREALL SETUP SCRIPT EXECUTING ==="
2+
Write-Warning "Setting up test environment..."
33

44
# Example setup tasks:
55
# - Deploy test infrastructure
@@ -8,5 +8,5 @@ Write-Host "Setting up test environment..."
88
# - Set up test databases
99
# - Configure test services
1010

11-
Write-Host "Test environment setup completed successfully!"
12-
Write-Host "=== BEFOREALL SETUP SCRIPT COMPLETED ==="
11+
Write-Warning "Test environment setup completed successfully!"
12+
Write-Warning "=== BEFOREALL SETUP SCRIPT COMPLETED ==="
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
Write-Host "=== AFTERALL TEARDOWN SCRIPT (Environments) EXECUTING ==="
2-
Write-Host "Tearing down test environment for Environments..."
1+
Write-Warning "=== AFTERALL TEARDOWN SCRIPT (Environments) EXECUTING ==="
2+
Write-Warning "Tearing down test environment for Environments..."
33

44
# Example teardown tasks for Environments directory:
5-
Write-Host "Cleaning up Environments test environment..."
5+
Write-Warning "Cleaning up Environments test environment..."
66

7-
Write-Host "Environments environment teardown completed successfully!"
8-
Write-Host "=== AFTERALL TEARDOWN SCRIPT (Environments) COMPLETED ==="
7+
Write-Warning "Environments environment teardown completed successfully!"
8+
Write-Warning "=== AFTERALL TEARDOWN SCRIPT (Environments) COMPLETED ==="
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
Write-Host "=== BEFOREALL SETUP SCRIPT EXECUTING ==="
2-
Write-Host "Setting up test environment..."
1+
Write-Warning "=== BEFOREALL SETUP SCRIPT EXECUTING ==="
2+
Write-Warning "Setting up test environment..."
33

44
# Example setup tasks for test environment:
5-
Write-Host "Initializing test environment..."
5+
Write-Warning "Initializing test environment..."
66

7-
Write-Host "Test environment setup completed successfully!"
8-
Write-Host "=== BEFOREALL SETUP SCRIPT COMPLETED ==="
7+
Write-Warning "Test environment setup completed successfully!"
8+
Write-Warning "=== BEFOREALL SETUP SCRIPT COMPLETED ==="

0 commit comments

Comments
 (0)