From a265d4df72224b92d01ebd9f73b7e0ade7216388 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Bergstro=CC=88m?= Date: Tue, 20 Feb 2024 20:10:32 -0300 Subject: [PATCH] chore: add test for checking hadolint_output --- .github/workflows/test-e2e.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/workflows/test-e2e.yml b/.github/workflows/test-e2e.yml index 533c906..8d60349 100644 --- a/.github/workflows/test-e2e.yml +++ b/.github/workflows/test-e2e.yml @@ -101,3 +101,24 @@ jobs: echo "::error::Version mismatch: \"${HADOLINT_VERSION}\" does not equal \"${REQUESTED_VERSION}\"" exit 1 fi + + gh-action-output: + name: Action populates output if configured + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - uses: ./ + id: action-output + with: + dockerfile: "test/fixtures/Dockerfile-valid" + annotate: false + output_format: json + - name: Compare output + env: + OUTPUT: ${{ steps.action-output.outputs.hadolint_output }} + ASSERT: '[{"code":"DL3018","column":1,"file":"test/fixtures/Dockerfile-warning","level":"warning","line":3,"message":"Pin versions in apk add. Instead of `apk add ` use `apk add =`"}]' + run: | + if [[ "${OUTPUT}" != "${ASSERT}" ]]; then + echo "::error::Output mismatch: \"${OUTPUT}\" does not equal \"${ASSERT}\"" + exit 1 + fi