Update containers.build.yaml

Signed-off-by: Kjeld Schouten <info@kjeldschouten.nl>
This commit is contained in:
Kjeld Schouten
2024-10-17 21:24:29 +02:00
committed by GitHub
parent fec5a49dd2
commit c1f31011a1
+11 -1
View File
@@ -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("(?<filepath>/?containers/(?<first_directory>(?<root1>[/]?)[^/]+/)(?<second_directory>(?<root2>[/]?)[^/]+)(?<extra_paths>/[^/]+)*)"; "\(.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