From bbfaed3c821c17a6fea02d1c60add86175f05709 Mon Sep 17 00:00:00 2001 From: qlebrun Date: Wed, 14 Aug 2024 11:14:12 +0200 Subject: [PATCH] feat: add hadolint report to PR comment --- .github/workflows/dockerfile-linter.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dockerfile-linter.yml b/.github/workflows/dockerfile-linter.yml index 318e1de..2c81c88 100644 --- a/.github/workflows/dockerfile-linter.yml +++ b/.github/workflows/dockerfile-linter.yml @@ -25,9 +25,27 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - uses: hadolint/hadolint-action@v3.1.0 with: dockerfile: ${{ inputs.dockerfile_path }} output-file: test-report.json format: json + + - 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 + })