Skip to content

Commit

Permalink
feat: add hadolint
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanpoensgen committed Sep 24, 2023
1 parent 9cce6a4 commit 2f8e895
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Lint Dockerfile
on:
workflow_dispatch:
pull_request:
push:
paths:
- "Dockerfile.template"

jobs:
lint:
name: 'Lint Dockerfile (PHP: ${{ matrix.php-version }})'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-version:
- '8.0'
- '8.1'
- '8.2'
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Lint Dockerfile
id: hadolint
uses: hadolint/hadolint-action@master
with:
dockerfile: ./${{ matrix.php-version }}/Dockerfile

- name: Update Pull Request
if: failure() && github.event_name == 'pull_request'
uses: actions/github-script@v6
with:
script: |
const output = `
#### Hadolint: \`${{ steps.hadolint.outcome }}\`
\`\`\`
${process.env.HADOLINT_RESULTS}
\`\`\`
`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: output
})

0 comments on commit 2f8e895

Please sign in to comment.