From c1f31011a1fbf718addc9a24b9e82389d5550fec Mon Sep 17 00:00:00 2001 From: Kjeld Schouten Date: Thu, 17 Oct 2024 21:24:29 +0200 Subject: [PATCH] Update containers.build.yaml Signed-off-by: Kjeld Schouten --- .github/workflows/containers.build.yaml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/containers.build.yaml b/.github/workflows/containers.build.yaml index a0685c17607..488c5c91c9e 100644 --- a/.github/workflows/containers.build.yaml +++ b/.github/workflows/containers.build.yaml @@ -29,6 +29,7 @@ jobs: runs-on: ubuntu-24.04 outputs: matrix: '{"container": ${{ steps.reduce.outputs.containers }} }' + containers_found: ${{ steps.reduce.outputs.containers_found }} # New output steps: - name: Checkout uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 @@ -45,7 +46,16 @@ jobs: - id: reduce run: | CONTAINERS=$(jq --raw-output '.changed_files | fromjson | .[] |= sub("(?/?containers/(?(?[/]?)[^/]+/)(?(?[/]?)[^/]+)(?/[^/]+)*)"; "\(.second_directory)") | unique' changes.json) + + # Set the containers output echo ::set-output name=containers::${CONTAINERS} + + # Check if containers were found and set the containers_found output + if [[ -z "$CONTAINERS" ]]; then + echo ::set-output name=containers_found::false + else + echo ::set-output name=containers_found::true + fi hadolint: name: Run hadolint @@ -85,7 +95,7 @@ jobs: strategy: matrix: ${{ fromJson(needs.changes.outputs.matrix) }} fail-fast: false - if: ${{ needs.changes.outputs.matrix != '{}' && needs.changes.outputs.matrix != '' && fromJson(needs.changes.outputs.matrix).container != null }} + if: ${{ needs.changes.outputs.containers_found == 'true' }} steps: - name: Checkout uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4