diff --git a/.github/workflows/yocto-build-deploy.yml b/.github/workflows/yocto-build-deploy.yml index caa400a37..dc1f6c975 100644 --- a/.github/workflows/yocto-build-deploy.yml +++ b/.github/workflows/yocto-build-deploy.yml @@ -245,6 +245,24 @@ jobs: Please contact a member of the organization for assistance." exit 1 + - name Validate inputs + run: | + # This can't possibly work, can it? + validate_json_array() { + echo ${{ inputs.$1 }} | jq ".[]" + status=$? + if [ $status -ne 0 ]; then + echo "INPUT ERROR: $1 must be JSON array, got ${{ inputs.$1 }}" + exit 1 + fi + } + + echo "Here we go..." + validate_json_array runs-on + validate_json_array test-suites + validate_json_array test-workers + echo "All done..." + # this must be done before putting files in the workspace # https://github.com/easimon/maximize-build-space - name: Maximize build space @@ -978,11 +996,6 @@ jobs: "WORKER_TYPE": ${{ inputs.test-workers }} } run: | - # Validate inputs meant to be JSON arrays. - echo ${{ inputs.runs-on }} | jq ".[]" || echo "INPUT ERROR: runs-on must be JSON array, got ${{ inputs.test-suites }}" - echo ${{ inputs.test-suites }} | jq ".[]" || echo "INPUT ERROR: test-suites must be JSON array, got ${{ inputs.test-suites }}" - echo ${{ inputs.test-workers }} | jq ".[]" || echo "INPUT ERROR: test-workers must be JSON array, got ${{ inputs.test-suites }}" - echo $json json=$(jq -e -c . <<<"${MATRIX}") || exit $? echo "json=${json}" >> "${GITHUB_OUTPUT}"