Forráskód Böngészése

Enhance kernel-info action to locate kernel Makefile

Updated the action to find all Makefiles and check for a VERSION variable in each. Improved error messaging for missing kernel Makefile.
jimsterino98 1 hónapja
szülő
commit
023b7908e3
1 módosított fájl, 14 hozzáadás és 8 törlés
  1. 14 8
      .github/actions/kernel-info/action.yml

+ 14 - 8
.github/actions/kernel-info/action.yml

@@ -14,17 +14,23 @@ runs:
         # Get repository tree without cloning
         TREE_URL="https://api.github.com/repos/$REPO/git/trees/$BRANCH?recursive=1"
 
-        MAKEFILE_PATH=$(curl -s "$TREE_URL" | \
-        jq -r '.tree[].path' | \
-        grep 'Makefile$' | \
-        head -n 1)
+        MAKEFILES=$(curl -s "$TREE_URL" | jq -r '.tree[].path' | grep 'Makefile$')
 
-        if [ -z "$MAKEFILE_PATH" ]; then
-          echo "::error::Could not find root Makefile"
-          exit 1
+        for file in $MAKEFILES; do
+        CONTENT=$(curl -s "https://raw.githubusercontent.com/$REPO/$BRANCH/$file")
+        
+        if echo "$CONTENT" | grep -q '^VERSION[[:space:]]*='; then
+           MAKEFILE_PATH="$file"
+           break
         fi
+        done
 
-        echo "Found: $MAKEFILE_PATH"
+        if [ -z "$MAKEFILE_PATH" ]; then
+        echo "::error::Could not find kernel Makefile"
+        exit 1
+        fi
+        
+        echo "Found kernel Makefile: $MAKEFILE_PATH"
 
         # Download only the Makefile
         RAW_URL="https://raw.githubusercontent.com/$REPO/$BRANCH/$MAKEFILE_PATH"