Skip to content

Commit 338d10c

Browse files
authored
Testing hadolint (#3)
* Testing hadolint * Added testing action with no event filtering * Fixed Dockerfile and hadlint
1 parent 8c69023 commit 338d10c

File tree

3 files changed

+47
-4
lines changed

3 files changed

+47
-4
lines changed

.github/workflows/hadolint.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Hadolint
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
docker:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: hadolint/[email protected]
15+
with:
16+
dockerfile: Dockerfile
17+
- name: Update Pull Request
18+
uses: actions/github-script@v6
19+
# if: github.event_name == 'pull_request'
20+
with:
21+
script: |
22+
const output = `
23+
#### Hadolint: \`${{ steps.hadolint.outcome }}\`
24+
\`\`\`
25+
${process.env.HADOLINT_RESULTS}
26+
\`\`\`
27+
`;
28+
29+
github.rest.issues.createComment({
30+
issue_number: context.issue.number,
31+
owner: context.repo.owner,
32+
repo: context.repo.repo,
33+
body: output
34+
})

.hadolint.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Hadolint configuration file
2+
3+
# configure ignore rules
4+
# see https://github.com/hadolint/hadolint#rules for a list of available rules.
5+
ignored:
6+
- DL3018
7+
- DL3042
8+
- DL3013
9+
- DL3059 # multi run

Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ LABEL "com.github.actions.description"="Run pylint and other commands"
55
LABEL "com.github.actions.icon"="upload-cloud"
66
LABEL "com.github.actions.color"="green"
77

8-
RUN apk add --no-cache bash build-base gcc
9-
RUN pip install --upgrade pip
10-
RUN pip install pylint pipenv
11-
RUN python --version ; pip --version ; pylint --version
8+
RUN apk add --no-cache bash build-base gcc && \
9+
pip install --upgrade pip && \
10+
pip install pylint pipenv && \
11+
python --version ; pip --version ; pylint --version
1212

1313
COPY entrypoint.sh /
1414
RUN chmod +x /entrypoint.sh

0 commit comments

Comments
 (0)