Skip to content

Commit eb92e6d

Browse files
committed
fix(docker-build): improve Hadolint comment handling by adding report reading step
1 parent 6036cf8 commit eb92e6d

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

.github/workflows/docker-build.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,17 +153,25 @@ jobs:
153153
cat hadolint.txt >> "$GITHUB_OUTPUT"
154154
echo "EOF" >> "$GITHUB_OUTPUT"
155155
156+
- name: Read Hadolint report file
157+
id: read_hadolint
158+
if: ${{ inputs.hadolint }}
159+
run: |
160+
echo "report<<EOF" >> "$GITHUB_OUTPUT"
161+
cat hadolint.txt >> "$GITHUB_OUTPUT"
162+
echo "EOF" >> "$GITHUB_OUTPUT"
163+
156164
- name: Find existing Hadolint comment
157-
if: github.event_name == 'pull_request' && inputs.hadolint
158165
id: find_hadolint
166+
if: ${{ inputs.hadolint }}
159167
uses: peter-evans/find-comment@v3
160168
with:
161169
issue-number: ${{ github.event.pull_request.number }}
162170
comment-author: 'github-actions[bot]'
163171
body-includes: 'Hadolint Dockerfile Lint Results'
164172

165173
- name: Create or update Hadolint comment
166-
if: github.event_name == 'pull_request' && inputs.hadolint && steps.read_hadolint.outputs.report != ''
174+
if: ${{ inputs.hadolint && steps.read_hadolint.outputs.report != '' }}
167175
uses: peter-evans/create-or-update-comment@v4
168176
with:
169177
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)