-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (38 loc) · 1.21 KB
/
lint-dockerfiles.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
---
name: Lint Dockerfiles
on: # yamllint disable-line rule:truthy
pull_request:
paths:
- "**/*Dockerfile*"
jobs:
hadolint:
runs-on: ubuntu-latest
outputs:
changed-files: ${{ steps.file-changes.outputs.changed-files }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Modified files
id: file-changes
run: |
echo \
"changed-files=$(git diff --name-only -r origin/${GITHUB_BASE_REF} origin/${GITHUB_HEAD_REF} \
| grep 'Dockerfile' \
| tr '\n' ' ')" \
>> $GITHUB_OUTPUT
- name: Check GitHub event type to determine reporter type
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo "REVIEWDOG_REPORTER=github-pr-review" >> $GITHUB_ENV
else
echo "REVIEWDOG_REPORTER=github-check" >> $GITHUB_ENV
fi
- name: Run hadolint
uses: reviewdog/action-hadolint@v1
with:
fail_on_error: false
filter_mode: diff_context
hadolint_flags: ${{ steps.file-changes.outputs.changed-files }}
level: error
reporter: ${{ env.REVIEWDOG_REPORTER }}