name: get kernel version before cloning description: get kernel version before cloning runs: using: composite steps: - name: Locate and extract kernel version shell: bash run: | REPO="WildKernels/Samsung_Kernels" echo "Searching for root Makefile on branch $BRANCH" # 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) if [ -z "$MAKEFILE_PATH" ]; then echo "::error::Could not find root Makefile" exit 1 fi echo "Found: $MAKEFILE_PATH" # Download only the Makefile RAW_URL="https://raw.githubusercontent.com/$REPO/$BRANCH/$MAKEFILE_PATH" MAKEFILE_CONTENT=$(curl -s "$RAW_URL") VERSION=$(echo "$MAKEFILE_CONTENT" | grep -m1 '^VERSION[[:space:]]*=' | awk '{print $3}') PATCHLEVEL=$(echo "$MAKEFILE_CONTENT" | grep -m1 '^PATCHLEVEL[[:space:]]*=' | awk '{print $3}') if [ -z "$VERSION" ] || [ -z "$PATCHLEVEL" ]; then echo "::error::Could not extract kernel version from Makefile" exit 1 fi KERNEL_VERSION="$VERSION.$PATCHLEVEL" if [ "$KERNEL_VERSION" = "5.10" ]; then ANDROID_VERSION="android12" elif [ "$KERNEL_VERSION" = "5.15" ]; then ANDROID_VERSION="android13" elif [ "$KERNEL_VERSION" = "6.1" ]; then ANDROID_VERSION="android14" elif [ "$KERNEL_VERSION" = "6.6" ]; then ANDROID_VERSION="android15" else ANDROID_VERSION="unknown" fi echo "Android: $ANDROID_VERSION" echo "Kernel: $KERNEL_VERSION" echo "ANDROID_VERSION=$ANDROID_VERSION" >> "$GITHUB_ENV" echo "KERNEL_VERSION=$KERNEL_VERSION" >> "$GITHUB_ENV"