Skip to content

Commit 6036cf8

Browse files
committed
fix(docker-build): update Hadolint comment creation to read report from file
1 parent 063c593 commit 6036cf8

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

.github/workflows/docker-build.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,14 @@ jobs:
145145
output-file: hadolint.txt
146146
no-fail: true
147147

148+
- name: Read Hadolint report file
149+
id: read_hadolint
150+
if: ${{ inputs.hadolint }}
151+
run: |
152+
echo "report<<EOF" >> "$GITHUB_OUTPUT"
153+
cat hadolint.txt >> "$GITHUB_OUTPUT"
154+
echo "EOF" >> "$GITHUB_OUTPUT"
155+
148156
- name: Find existing Hadolint comment
149157
if: github.event_name == 'pull_request' && inputs.hadolint
150158
id: find_hadolint
@@ -155,7 +163,7 @@ jobs:
155163
body-includes: 'Hadolint Dockerfile Lint Results'
156164

157165
- name: Create or update Hadolint comment
158-
if: github.event_name == 'pull_request' && inputs.hadolint && steps.hadolint.outputs.report != ''
166+
if: github.event_name == 'pull_request' && inputs.hadolint && steps.read_hadolint.outputs.report != ''
159167
uses: peter-evans/create-or-update-comment@v4
160168
with:
161169
token: ${{ secrets.GITHUB_TOKEN }}
@@ -165,9 +173,9 @@ jobs:
165173
body: |
166174
<!-- hadolint-scan -->
167175
### 🐳 Hadolint Dockerfile Lint Results
168-
<details><summary>Click to expand</summary>
176+
<details><summary>Click to expand detailed results</summary>
169177
170178
```bash
171-
${{ steps.hadolint.outputs.report }}
179+
${{ steps.read_hadolint.outputs.report }}
172180
```
173181
</details>

0 commit comments

Comments
 (0)