From 26eafb7b6d807f559f0bd8c78a6c298168857226 Mon Sep 17 00:00:00 2001 From: Stefan Poensgen Date: Sun, 24 Sep 2023 20:34:03 +0200 Subject: [PATCH] feat: add hadolint --- .github/workflows/lint.yml | 46 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..6984c59 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,46 @@ +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 + uses: hadolint/hadolint-action@master + with: + dockerfile: ./${{ matrix.php-version }}/Dockerfile + + - name: Update Pull Request + uses: actions/github-script@v6 + if: github.event_name == 'pull_request' + 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 + }) \ No newline at end of file