2929 run : |
3030 echo "timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> $GITHUB_OUTPUT
3131 echo "commit_sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
32- echo "commit_msg<<EOF" >> $GITHUB_OUTPUT
33- git log -1 --pretty=%B >> $GITHUB_OUTPUT
34- echo "EOF" >> $GITHUB_OUTPUT
32+ echo "commit_msg=$(git log -1 --pretty=%B | tr -d '\r' | tr -d '\n')" >> $GITHUB_OUTPUT
3533
3634 - name : 🔍 Check for PowerShell Files
3735 id : check-ps1
7674 }
7775 }
7876 Invoke-ScriptAnalyzer @htPSA
79- Write-Output "Auto-fix completed for indentation and whitespace ."
77+ Write-Output "Auto-fix completed."
8078
8179 - name : 📝 Commit Auto-Fixed Files
8280 if : github.event_name == 'push'
@@ -134,6 +132,7 @@ jobs:
134132 Write-Error "PSScriptAnalyzer found errors"
135133 exit 1
136134 }
135+
137136 if ($results) {
138137 Write-Output "Found $($results.Count) issue(s)."
139138 $sarifResults = $results | ForEach-Object {
@@ -151,16 +150,28 @@ jobs:
151150 )
152151 }
153152 }
153+
154154 $sarif = @{
155155 '$schema' = 'http://json.schemastore.org/sarif-2.1.0'
156- version = '2.1.0'
157- runs = @(@{ tool = @{ driver = @{ name = 'PSScriptAnalyzer'; version = $version } }; results = $sarifResults })
156+ version = '2.1.0'
157+ runs = @(
158+ @{
159+ tool = @{
160+ driver = @{
161+ name = 'PSScriptAnalyzer'
162+ version = $version
163+ }
164+ }
165+ results = $sarifResults
166+ }
167+ )
158168 }
159169 $sarif | ConvertTo-Json -Depth 10 | Out-File -FilePath $sarifFile -Encoding utf8
160170 Write-Output "SARIF file generated: $sarifFile"
161171 } else {
162172 Write-Output "No issues found."
163173 '{"$schema": "http://json.schemastore.org/sarif-2.1.0", "version": "2.1.0", "runs": []}' | Out-File -FilePath $sarifFile -Encoding utf8
174+ }
164175
165176 - name : 📊 Upload Analysis Results
166177 if : always()
@@ -188,11 +199,15 @@ jobs:
188199 $commit = '${{ steps.metadata.outputs.commit_sha }}'
189200 $commitMsg = '${{ steps.metadata.outputs.commit_msg }}'
190201 $repo = "${{ github.repository }}"
191- $summary = "### 🧪 PowerShell Lint Summary`n"
192- $summary += "- 🕒 Timestamp: $timestamp`n"
193- $summary += "- 🔗 Commit: [$commit](https://github.com/$repo/commit/$commit)`n"
194- $summary += "- 📝 Message: $commitMsg`n"
195- $summary += "- 📦 Repository: [$repo](https://github.com/$repo)`n`n"
202+
203+ $summary = @"
204+ # ## 🧪 PowerShell Lint Summary
205+ - 🕒 Timestamp : $timestamp
206+ - 🔗 Commit : [$commit](https://github.com/$repo/commit/$commit)
207+ - 📝 Message : $commitMsg
208+ - 📦 Repository : [$repo](https://github.com/$repo)
209+
210+ " @
196211
197212 if (Test-Path $sarifPath) {
198213 $sarif = Get-Content $sarifPath -Raw | ConvertFrom-Json
0 commit comments