Browse Source

fix(action): improve error handling for missing config file and jq dependency

Co-authored-by: Copilot <copilot@github.com>
TheWildJames 4 months ago
parent
commit
2613c7ae6c
1 changed files with 6 additions and 9 deletions
  1. 6 9
      .github/workflows/prepare.yml

+ 6 - 9
.github/workflows/prepare.yml

@@ -49,19 +49,16 @@ jobs:
             echo "Error: Config file not found: ${{ inputs.config_file }}"
             exit 1
           fi
-          
-          # Read the file content
+
           MATRIX_JSON=$(cat "${{ inputs.config_file }}")
-          
-          # Compact the JSON to a single line to avoid issues
-          # If jq is not available, we might need another way, but ubuntu-latest usually has it.
+
           if command -v jq &> /dev/null; then
-            MATRIX_JSON=$(echo "$MATRIX_JSON" | jq -c .)
+            MATRIX_JSON=$(echo "$MATRIX_JSON" | jq -c '[.include[].kernel_version]')
           else
-            # Fallback for simple minification if jq missing (unlikely on runner)
-            MATRIX_JSON=$(echo "$MATRIX_JSON" | tr -d '\n' | tr -d ' ')
+            echo "jq not found, cannot build matrix."
+            exit 1
           fi
-          
+
           echo "Matrix content: $MATRIX_JSON"
           echo "matrix=$MATRIX_JSON" >> $GITHUB_OUTPUT