Add workflow to lint Dockerfile
using hadolint
#1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci:lint-dockerfile | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
merge_group: | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
jobs: | ||
lint: | ||
name: Continuous integration (lint dockerfile) | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 2 | ||
steps: | ||
- name: Checkout 🛎️ | ||
uses: actions/checkout@v4 | ||
- name: Lint workflows 👕 | ||
uses: hadolint/hadolint-action@v3.1.0 | ||
with: | ||
dockerfile: ./Dockerfile | ||
- name: Annotate PR 📣 | ||
uses: actions/github-script@v6 | ||
if: github.event_name == 'pull_request' | ||
with: | ||
Check failure on line 32 in .github/workflows/ci:lint-dockerfile.yml GitHub Actions / ci:lint-dockerfileInvalid workflow file
|
||
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 | ||
}) |