build.yml 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  1. name: Kernel Build Process
  2. permissions:
  3. contents: write
  4. actions: write
  5. on:
  6. workflow_call:
  7. inputs:
  8. branch:
  9. required: true
  10. type: string
  11. android_version:
  12. required: true
  13. type: string
  14. kernel_version:
  15. required: true
  16. type: string
  17. jobs:
  18. build-samsung-gki:
  19. name: "${{ inputs.branch }}-${{ inputs.kernel_version }}-${{ inputs.android_version }}"
  20. runs-on: ubuntu-latest
  21. strategy:
  22. fail-fast: false
  23. steps:
  24. - name: Check Initial Disk Space
  25. run: |
  26. echo "===== Initial Total Disk Space in GB ====="
  27. df -BG
  28. - name: Download Apache Arrow's util_free_space.sh
  29. run: |
  30. curl -L -o util_free_space.sh https://raw.githubusercontent.com/apache/arrow/main/ci/scripts/util_free_space.sh
  31. chmod +x util_free_space.sh
  32. ./util_free_space.sh
  33. - name: Check Disk Space After Cleanup
  34. run: |
  35. echo "===== Total Disk Space After Cleanup in GB ====="
  36. df -BG
  37. - name: Set CONFIG Environment Variable
  38. run: |
  39. # Set CONFIG dynamically based on inputs values
  40. CONFIG="${{ inputs.branch }}-${{ inputs.android_version }}-${{ inputs.kernel_version }}"
  41. # Set CONFIG as an environment variable for future steps
  42. echo "CONFIG=$CONFIG" >> $GITHUB_ENV
  43. - name: Clone AnyKernel3 and Other Dependencies
  44. run: |
  45. ANYKERNEL_BRANCH="gki-2.0"
  46. SUSFS_BRANCH="gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}"
  47. git clone https://github.com/WildKernels/AnyKernel3.git -b "$ANYKERNEL_BRANCH"
  48. git clone https://github.com/WildKernels/kernel_patches.git
  49. git clone https://gitlab.com/simonpunk/susfs4ksu.git -b "$SUSFS_BRANCH"
  50. - name: Clone Kernel Source
  51. run: |
  52. git clone https://github.com/WildKernels/Samsung_Kernels.git -b ${{ inputs.branch }} $CONFIG
  53. - name: Set Path Environment Variables
  54. run: |
  55. ROOT="$GITHUB_WORKSPACE"
  56. SUSFS4KSU="$ROOT/susfs4ksu"
  57. KERNEL_PATCHES="$ROOT/kernel_patches"
  58. ANYKERNEL3="$ROOT/AnyKernel3"
  59. if [[ "${{ inputs.branch }}" == "SM-A546B-Oneui7" || "${{ inputs.branch }}" == "SM-A546E-Oneui7" ]]; then
  60. COMMON="$CONFIG"
  61. elif [[ "${{ inputs.branch }}" == "SM-A566B" ]]; then
  62. COMMON="$CONFIG/kernel-6.6"
  63. elif [[ "${{ inputs.branch }}" == "SM-S926B-Oneui8" ]]; then
  64. COMMON="$CONFIG/kernel"
  65. else
  66. COMMON="$CONFIG/kernel_platform/common"
  67. fi
  68. DEFCONFIG="$COMMON/arch/arm64/configs/gki_defconfig"
  69. echo "ROOT=$ROOT" >> $GITHUB_ENV
  70. echo "SUSFS4KSU=$SUSFS4KSU" >> $GITHUB_ENV
  71. echo "KERNEL_PATCHES=$KERNEL_PATCHES" >> $GITHUB_ENV
  72. echo "ANYKERNEL3=$ANYKERNEL3" >> $GITHUB_ENV
  73. echo "COMMON=$COMMON" >> $GITHUB_ENV
  74. echo "DEFCONFIG=$DEFCONFIG" >> $GITHUB_ENV
  75. - name: Extract all tar.xz files and delete them
  76. run: |
  77. cd "$CONFIG"
  78. find . -type f -name '*.tar.xz' -print0 | while IFS= read -r -d '' file; do
  79. echo "Extracting $file"
  80. tar -xf "$file"
  81. rm "$file"
  82. done
  83. - name: Check Directory Space Usage
  84. run: |
  85. echo "===== Total Disk Space After Kernel Download in GB ====="
  86. df -BG
  87. echo "===== Directory Space Usage in GB ====="
  88. du -BG -d 1 | sort -nr
  89. echo "===== $CONFIG Directory Space Usage in GB ====="
  90. cd "$CONFIG"
  91. du -BG -d 2 | sort -nr
  92. - name: Add Wild_KSU
  93. run: |
  94. cd "$COMMON"
  95. curl -LSs "https://raw.githubusercontent.com/WildKernels/Wild_KSU/wild/kernel/setup.sh" | bash -s stable
  96. - name: Getting Wild_KSU Version
  97. run: |
  98. cd "$COMMON/Wild_KSU/kernel"
  99. KSU_DIR=$(pwd)
  100. KBUILD="Kbuild"
  101. BASE_VERSION=30000
  102. if [ -d "$KSU_DIR/.git" ]; then
  103. echo "✔ Git repo detected"
  104. # Unshallow if needed
  105. if [ -f "$KSU_DIR/.git/shallow" ]; then
  106. git -C "$KSU_DIR" fetch --unshallow || true
  107. fi
  108. # Get commit count
  109. KSU_GIT_VERSION=$(git -C "$KSU_DIR" rev-list --count HEAD)
  110. # Calculate version
  111. KSU_VERSION=$((BASE_VERSION + KSU_GIT_VERSION))
  112. # Get latest tag (safe)
  113. KSU_GIT_TAG=$(git -C "$KSU_DIR" describe --tags --abbrev=0 2>/dev/null || echo "v0.0.1")
  114. else
  115. echo "⚠ Not a git repo, using defaults"
  116. KSU_VERSION=33151
  117. KSU_GIT_TAG="v3.0.0"
  118. fi
  119. echo "Computed version: $KSU_VERSION"
  120. echo "Computed tag: $KSU_GIT_TAG"
  121. # Export for CI (optional)
  122. echo "KSU_VERSION=$KSU_VERSION" >> $GITHUB_ENV
  123. echo "KSU_VERSION_TAG=$KSU_GIT_TAG" >> $GITHUB_ENV
  124. # --- Update Kbuild fallback values ---
  125. # Update numeric fallback
  126. sed -i "s/KSU_VERSION_FALLBACK := [0-9]\+/KSU_VERSION_FALLBACK := ${KSU_VERSION}/" "$KBUILD"
  127. # Update tag fallback
  128. sed -i "s/KSU_VERSION_TAG_FALLBACK := .*/KSU_VERSION_TAG_FALLBACK := ${KSU_GIT_TAG}/" "$KBUILD"
  129. echo "✅ Updated fallback values in $KBUILD"
  130. - name: Apply SUSFS Patches
  131. run: |
  132. cd "$COMMON"
  133. # Apply compatibility fixes
  134. SUSFS_VERSION="2.0.0"
  135. cp "$SUSFS4KSU/kernel_patches/fs/"* ./fs/
  136. cp "$SUSFS4KSU/kernel_patches/include/linux/"* ./include/linux/
  137. cp "$SUSFS4KSU/kernel_patches/50_add_susfs_in_gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch" ./
  138. # Apply SUSFS core patch
  139. patch -p1 < 50_add_susfs_in_gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch || true
  140. # Fix SUSFS rejects
  141. if [[ "${{ inputs.branch }}" == "SM-S928B-Oneui7" || "${{ inputs.branch }}" == "SM-S928B-Oneui8" ]]; then
  142. cp "$KERNEL_PATCHES/samsung/S24U/"* ./
  143. patch -p1 < fix_namespace.patch
  144. patch -p1 < fix_base.patch
  145. elif [[ "${{ inputs.branch }}" == "SM-A366B" ]]; then
  146. cp "$KERNEL_PATCHES/samsung/${{ inputs.branch }}/"* ./
  147. patch -p1 < fix_namespace.patch
  148. patch -p1 < fix_base.patch
  149. patch -p1 < fix_taskmmu.patch
  150. elif [[ "${{ inputs.branch }}" == "SM-X916B" ]]; then
  151. cp "$KERNEL_PATCHES/samsung/${{ inputs.branch }}/"* ./
  152. patch -p1 < fix_namespace.patch
  153. patch -p1 < fix_base.patch
  154. elif [[ "${{ inputs.branch }}" == "SM-F946N" ]]; then
  155. cp "$KERNEL_PATCHES/samsung/${{ inputs.branch }}/"* ./
  156. patch -p1 < fix_namespace.patch
  157. patch -p1 < fix_base.patch
  158. elif [[ "${{ inputs.branch }}" == "SM-A546B-Oneui7" ]]; then
  159. cp "$KERNEL_PATCHES/samsung/${{ inputs.branch }}/"* ./
  160. patch -p1 < fix_namespace.patch
  161. patch -p1 < fix_base.patch
  162. patch -p1 < Disable_CRC.patch
  163. elif [[ "${{ inputs.branch }}" == "SM-A566B" ]]; then
  164. cp "$KERNEL_PATCHES/samsung/${{ inputs.branch }}/"* ./
  165. patch -p1 < fix_namespace.patch
  166. patch -p1 < fix_base.patch
  167. patch -p1 < fix_taskmmu.patch
  168. elif [[ "${{ inputs.branch }}" == "SM-S916B-Oneui8" ]]; then
  169. cp "$KERNEL_PATCHES/samsung/${{ inputs.branch }}/"* ./
  170. patch -p1 < fix_namespace.patch
  171. patch -p1 < fix_base.patch
  172. elif [[ "${{ inputs.branch }}" == "SM-S926B-Oneui8" ]]; then
  173. cp "$KERNEL_PATCHES/samsung/${{ inputs.branch }}/"* ./
  174. patch -p1 < fix_namespace.patch
  175. patch -p1 < fix_base.patch
  176. fi
  177. - name: Add BBG
  178. run: |
  179. cd "$COMMON"
  180. echo "Adding BBG..."
  181. curl -LSs https://github.com/vc-teahouse/Baseband-guard/raw/main/setup.sh | bash
  182. echo "CONFIG_BBG=y" >> arch/arm64/configs/gki_defconfig
  183. sed -i '/^config LSM$/,/^help$/{ /^[[:space:]]*default/ { /baseband_guard/! s/selinux/selinux,baseband_guard/ } }' security/Kconfig
  184. - name: Set Kernel Configuration Variables
  185. run: |
  186. echo "Initializing kernel configuration..."
  187. cat >> "$DEFCONFIG" << 'EOF'
  188. # KernelSU Configuration
  189. CONFIG_KSU=y
  190. CONFIG_KSU_SUSFS=y
  191. # KPatch Next Support
  192. CONFIG_KALLSYMS=y
  193. CONFIG_KALLSYMS_ALL=y
  194. # Mountify Support
  195. CONFIG_TMPFS_XATTR=y
  196. CONFIG_TMPFS_POSIX_ACL=y
  197. # nuke root protection
  198. CONFIG_UH=n
  199. CONFIG_UH_RKP=n
  200. CONFIG_UH_LKMAUTH=n
  201. CONFIG_UH_LKM_BLOCK=n
  202. CONFIG_RKP_CFP_JOPP=n
  203. CONFIG_RKP_CFP=n
  204. CONFIG_SECURITY_DEFEX=n
  205. CONFIG_PROCA=n
  206. CONFIG_FIVE=n
  207. # Remove check_defconfig
  208. sed -i 's/check_defconfig//' ./build.config.gki
  209. - name: Change Kernel Name
  210. run: |
  211. cd "$COMMON"
  212. #Add Wild to Kernel Version
  213. sed -i '$s|echo "\$res"|echo "\$res-Wild"|' ./scripts/setlocalversion
  214. #Set Kernel Timestamp
  215. perl -pi -e 's{UTS_VERSION="\$\(echo \$UTS_VERSION \$CONFIG_FLAGS \$TIMESTAMP \| cut -b -\$UTS_LEN\)"}{UTS_VERSION="#1 SMP PREEMPT Sun Apr 20 04:20:00 UTC 2025"}' ./scripts/mkcompile_h
  216. if [ -f "build/build.sh" ]; then
  217. #Remove Dirty Flag
  218. sed -i 's/-dirty//' ./scripts/setlocalversion
  219. else
  220. #Remove Abi Exports and Error
  221. rm -rf ./android/abi_gki_protected_exports_*
  222. perl -pi -e 's/^\s*"protected_exports_list"\s*:\s*"android\/abi_gki_protected_exports_aarch64",\s*$//;' ./BUILD.bazel
  223. fi
  224. - name: Set file name
  225. run: |
  226. ARTIFACT_BASE="${{ inputs.branch }}-${{ inputs.kernel_version }}-${{ inputs.android_version }}"
  227. echo "ARTIFACT_BASE=$ARTIFACT_BASE" >> $GITHUB_ENV
  228. echo "FILE_NAME=$ARTIFACT_BASE" >> $GITHUB_ENV
  229. - name: Build
  230. run : |
  231. set -e
  232. set -x
  233. cd "$CONFIG"
  234. echo "Building the kernel..."
  235. if [[ "${{ inputs.branch }}" == "SM-S928B-Oneui7" || "${{ inputs.branch }}" == "SM-S928B-Oneui8" ]]; then
  236. chmod +x build_kernel_GKI.sh
  237. ./build_kernel_GKI.sh
  238. elif [[ "${{ inputs.branch }}" == "SM-X916B" || "${{ inputs.branch }}" == "SM-F946N" || "${{ inputs.branch }}" == "SM-S916B-Oneui8" ]]; then
  239. chmod +x build_kernel_GKI.sh
  240. LTO=thin ./build_kernel_GKI.sh || true
  241. elif [[ "${{ inputs.branch }}" == "SM-A546B-Oneui7" || "${{ inputs.branch }}" == "SM-A546E-Oneui7" ]]; then
  242. sudo apt update
  243. sudo apt-get install -y libyaml-dev
  244. LTO=thin ./build_kernel.sh || true
  245. elif [[ "${{ inputs.branch }}" == "SM-A566B" ]]; then
  246. chmod +x build_script.sh
  247. touch ./kernel-6.6/abi_symbollist.raw
  248. touch ./kernel-6.6/abi_symbollist
  249. ./build_script.sh
  250. elif [[ "${{ inputs.branch }}" == "SM-S926B-Oneui8" ]]; then
  251. tools/bazel run --nocheck_bzl_visibility --config=stamp --sandbox_debug --verbose_failures --debug_make_verbosity=I //projects/s5e9945:s5e9945_user_dist
  252. else
  253. #temporarily using this until i can figure out the other phones build script issues
  254. cd kernel_platform
  255. tools/bazel build --config=fast --lto=thin //common:kernel_aarch64_dist || exit 1
  256. fi
  257. - name: Prepare AnyKernel3
  258. run: |
  259. cd "$CONFIG"
  260. # Copy Image from normal build locations
  261. #if [ -f "./$CONFIG/out/${{ inputs.android_version }}-${{ inputs.kernel_version }}/dist/Image" ]; then
  262. # cp ./$CONFIG/out/${{ inputs.android_version }}-${{ inputs.kernel_version }}/dist/Image AnyKernel3/Image
  263. #elif [ -f "./$CONFIG/bazel-bin/common/kernel_aarch64/Image" ]; then
  264. # cp ./$CONFIG/bazel-bin/common/kernel_aarch64/Image AnyKernel3/Image
  265. #else
  266. # echo "Error: Image file not found in any expected location"
  267. # exit 1
  268. #fi
  269. if [[ "${{ inputs.branch }}" == "SM-S928B-Oneui7" || "${{ inputs.branch }}" == "SM-S928B-Oneui8" ]]; then
  270. cp ./kernel_platform/sec/dist/Image "$ANYKERNEL3/Image"
  271. elif [[ -f ./$CONFIG/bazel-bin/common/kernel_aarch64/Image ]]; then
  272. cp ./$CONFIG/bazel-bin/common/kernel_aarch64/Image "$ANYKERNEL3/Image"
  273. elif [[ "${{ inputs.branch }}" == "SM-X916B" || "${{ inputs.branch }}" == "SM-F946N" || "${{ inputs.branch }}" == "SM-S916B-Oneui8" ]]; then
  274. cp ./out/msm-kalama-kalama-gki/dist/Image "$ANYKERNEL3/Image"
  275. elif [[ "${{ inputs.branch }}" == "SM-A546B-Oneui7" || "${{ inputs.branch }}" == "SM-A546E-Oneui7" ]]; then
  276. cp ./arch/arm64/boot/Image "$ANYKERNEL3/Image"
  277. elif [[ "${{ inputs.branch }}" == "SM-A566B" ]]; then
  278. cp ./kernel-6.6/out/arch/arm64/boot/Image "$ANYKERNEL3/Image"
  279. elif [[ "${{ inputs.branch }}" == "SM-S926B-Oneui8" ]]; then
  280. cp ./out/s5e9945_user/dist/Image "$ANYKERNEL3/Image"
  281. else
  282. echo "Error: Image file not found in any expected location"
  283. exit 1
  284. fi
  285. - name: Create Bootimgs Folder and Copy Images for Android 14/15
  286. if: ${{ inputs.android_version == 'android14' || inputs.android_version == 'android15' }}
  287. run: |
  288. #mkdir bootimgs
  289. #cp ./$CONFIG/bazel-bin/common/kernel_aarch64/Image ./bootimgs
  290. #cp ./$CONFIG/bazel-bin/common/kernel_aarch64/Image.lz4 ./bootimgs
  291. #cp ./$CONFIG/bazel-bin/common/kernel_aarch64/Image ./${{ env.FILE_NAME }}-Image
  292. #cp ./$CONFIG/bazel-bin/common/kernel_aarch64/Image.lz4 ./${{ env.FILE_NAME }}-Image.lz4
  293. # Create gzip of the Image file
  294. #gzip -n -k -f -9 ./${{ env.FILE_NAME }}-Image > ./${{ env.FILE_NAME }}-Image.gz
  295. #gzip -n -k -f -9 ./bootimgs/Image > ./bootimgs/Image.gz
  296. #cp ./boot-lz4.img ../${{ env.FILE_NAME }}-boot-lz4.img
  297. - name: Upload AnyKernel3 Artifacts
  298. id: upload_ak3
  299. uses: actions/upload-artifact@v4
  300. with:
  301. name: ${{ env.FILE_NAME }}-AnyKernel3
  302. path: |
  303. ./AnyKernel3/**
  304. compression-level: 9
  305. - name: Scan and collect patch rejects
  306. if: ${{ always() }}
  307. run: |
  308. set -e
  309. CONFIG_DIR="$CONFIG"
  310. REJECTS_DIR="$GITHUB_WORKSPACE/patch-rejects"
  311. mkdir -p "$REJECTS_DIR"
  312. # Find all .rej files under the configuration directory
  313. mapfile -t REJS < <(find "$CONFIG_DIR" -type f -name '*.rej')
  314. REJ_COUNT=${#REJS[@]}
  315. echo "Found $REJ_COUNT .rej files under $CONFIG_DIR"
  316. echo "REJ_COUNT=$REJ_COUNT" >> $GITHUB_ENV
  317. if [ "$REJ_COUNT" -gt 0 ]; then
  318. for REJ in "${REJS[@]}"; do
  319. # Relative path from $CONFIG
  320. REL="${REJ#"$CONFIG_DIR"/}"
  321. DEST="$REJECTS_DIR/$REL"
  322. mkdir -p "$(dirname "$DEST")"
  323. cp "$REJ" "$DEST"
  324. # Copy the associated original file alongside the .rej
  325. ORIG="${REJ%.rej}"
  326. if [ -f "$ORIG" ]; then
  327. ORIG_DEST="$REJECTS_DIR/${REL%.rej}"
  328. mkdir -p "$(dirname "$ORIG_DEST")"
  329. cp "$ORIG" "$ORIG_DEST"
  330. fi
  331. echo "$REL" >> "$REJECTS_DIR/index.txt"
  332. done
  333. fi
  334. - name: Generate Build Summary
  335. if: ${{ always() }}
  336. run: |
  337. # Create build summary file for inclusion in Misc artifact
  338. echo "# Kernel Build Summary" > build_summary.md
  339. # Add build variant header
  340. echo "## ${{ env.FILE_NAME }}" >> build_summary.md
  341. # Add build info
  342. echo "## Build Information" >> build_summary.md
  343. echo "- **Android Version**: ${{ inputs.android_version }}" >> build_summary.md
  344. echo "- **Kernel Version**: ${{ inputs.kernel_version }}.${{ inputs.sub_level }}" >> build_summary.md
  345. echo "- **BBG**: Installed" >> build_summary.md
  346. echo "- **Bypass Mode**: ${{ matrix.apply_bypass }}" >> build_summary.md
  347. echo "" >> build_summary.md
  348. # Get Wild_KSU commit
  349. if [ -d "$CONFIG/Wild_KSU" ]; then
  350. cd "$CONFIG/Wild_KSU"
  351. WKSU_COMMIT=$(git rev-parse HEAD)
  352. WKSU_URL="https://github.com/WildKernels/Wild_KSU/commit/$WKSU_COMMIT"
  353. echo "- **Wild_KSU**: [$WKSU_COMMIT]($WKSU_URL)" >> "$GITHUB_WORKSPACE/build_summary.md"
  354. cd "$GITHUB_WORKSPACE"
  355. else
  356. echo "- **Wild_KSU**: not present" >> build_summary.md
  357. fi
  358. # Get Baseband-guard commit
  359. if [ -d "$CONFIG/Baseband-guard" ]; then
  360. cd "$CONFIG/Baseband-guard"
  361. BBG_COMMIT=$(git rev-parse HEAD)
  362. BBG_URL="https://github.com/vc-teahouse/Baseband-guard/commit/$BBG_COMMIT"
  363. echo "- **Baseband-guard**: [$BBG_COMMIT]($BBG_URL)" >> "$GITHUB_WORKSPACE/build_summary.md"
  364. cd "$GITHUB_WORKSPACE"
  365. else
  366. echo "- **Baseband-guard**: not present" >> build_summary.md
  367. fi
  368. # Get SUSFS4KSU commit
  369. if [ -d "$GITHUB_WORKSPACE/susfs4ksu" ]; then
  370. cd "$GITHUB_WORKSPACE/susfs4ksu"
  371. SUSFS_COMMIT=$(git rev-parse HEAD)
  372. SUSFS_URL="https://gitlab.com/simonpunk/susfs4ksu/-/commit/$SUSFS_COMMIT"
  373. echo "- **SUSFS4KSU (v1.5.12)**: [$SUSFS_COMMIT]($SUSFS_URL)" >> "$GITHUB_WORKSPACE/build_summary.md"
  374. cd "$GITHUB_WORKSPACE"
  375. else
  376. echo "- **SUSFS4KSU (v1.5.12)**: not present" >> build_summary.md
  377. fi
  378. echo "" >> build_summary.md
  379. # Add artifact summary with presence verification
  380. echo "## Build Artifacts" >> build_summary.md
  381. # Verify AnyKernel3 contents - check if kernel Image was actually copied (indicates successful build)
  382. if [ -d "AnyKernel3" ] && [ -f "AnyKernel3/Image" ]; then
  383. AK3_STATUS="✅"
  384. else
  385. AK3_STATUS="❌"
  386. fi
  387. echo "- **AnyKernel3**: $AK3_STATUS ${{ env.FILE_NAME }}-AnyKernel3" >> build_summary.md
  388. echo "### Misc (uploaded files)" >> build_summary.md
  389. FILES_PRESENT=0
  390. for f in "${{ env.FILE_NAME }}-Image" "${{ env.FILE_NAME }}-Image.gz" "${{ env.FILE_NAME }}-Image.lz4" "${{ env.FILE_NAME }}-boot.img" "${{ env.FILE_NAME }}-boot-gz.img" "${{ env.FILE_NAME }}-boot-lz4.img"; do
  391. if [ -f "$f" ]; then FILES_PRESENT=$((FILES_PRESENT+1)); fi
  392. done
  393. if [ "$FILES_PRESENT" -gt 0 ]; then
  394. MISC_STATUS="✅"
  395. else
  396. MISC_STATUS="❌"
  397. fi
  398. echo "- **Set**: $MISC_STATUS ${{ env.FILE_NAME }}-Misc" >> build_summary.md
  399. if [ "$MISC_STATUS" = "✅" ]; then
  400. echo " Included:" >> build_summary.md
  401. for f in "${{ env.FILE_NAME }}-Image" "${{ env.FILE_NAME }}-Image.gz" "${{ env.FILE_NAME }}-Image.lz4" "${{ env.FILE_NAME }}-boot.img" "${{ env.FILE_NAME }}-boot-gz.img" "${{ env.FILE_NAME }}-boot-lz4.img"; do
  402. if [ -f "$f" ]; then
  403. echo " - $f" >> build_summary.md
  404. fi
  405. done
  406. fi
  407. echo "### Diagnostics" >> build_summary.md
  408. echo "- **Rejected Patches**: ${{ env.FILE_NAME }}-Rejected-Patches" >> build_summary.md
  409. if [ -f patch-rejects/index.txt ]; then
  410. if [ -s patch-rejects/index.txt ]; then
  411. echo " Rejected files:" >> build_summary.md
  412. while IFS= read -r line; do
  413. echo " - $line" >> build_summary.md
  414. done < patch-rejects/index.txt
  415. else
  416. echo " Rejected file list is empty." >> build_summary.md
  417. fi
  418. else
  419. echo " No rejected patches found." >> build_summary.md
  420. fi