Skip to content

Commit 4b980c8

Browse files
🩹 [Refactor]: Enhance super-linter integration by posting summary on failure and failing the job if issues are found
1 parent 06f46e6 commit 4b980c8

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

‎.github/workflows/workflow.yml‎

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,30 @@ jobs:
132132
}
133133
134134
- name: Lint code base
135+
id: super-linter
135136
uses: super-linter/super-linter@7bba2eeb89d01dc9bfd93c497477a57e72c83240 # v8.2.0
137+
continue-on-error: true
136138
env:
137139
GITHUB_TOKEN: ${{ github.token }}
140+
ENABLE_GITHUB_ACTIONS_STEP_SUMMARY: false
141+
SAVE_SUPER_LINTER_SUMMARY: true
138142

139-
- name: Clear super-linter summary
143+
- name: Post super-linter summary on failure
144+
if: steps.super-linter.outcome == 'failure'
140145
run: |
141-
'test' | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Force -Encoding utf8
146+
Write-Host "Super-linter found issues. Generating summary..."
147+
$summaryPath = Join-Path $env:GITHUB_WORKSPACE 'super-linter-output' 'super-linter-summary.md'
148+
if (Test-Path $summaryPath) {
149+
Get-Content $summaryPath | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append
150+
} else {
151+
Write-Host "::warning::Super-linter failed but summary file not found at: $summaryPath"
152+
}
153+
154+
- name: Fail job if linting failed
155+
if: steps.super-linter.outcome == 'failure'
156+
run: |
157+
Write-Host "::error::Super-linter found issues. Please review the summary above."
158+
exit 1
142159
143160
# Runs on:
144161
# - ✅ Open/Updated PR - Builds module for testing

0 commit comments

Comments
 (0)