action.yml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. name: Fetch Latest Commits
  2. description: "Fetches the latest commit hashes for KernelSU-Next, AnyKernel3, Kernel Patches, SUSFS, and BBG"
  3. outputs:
  4. ksu_commit:
  5. description: "KernelSU-Next Commit"
  6. value: ${{ steps.commits.outputs.ksu_commit }}
  7. ksu_tag:
  8. description: "KernelSU-Next Tag (best effort)"
  9. value: ${{ steps.commits.outputs.ksu_tag }}
  10. anykernel_commit:
  11. description: "AnyKernel3 Commit"
  12. value: ${{ steps.commits.outputs.anykernel_commit }}
  13. patches_commit:
  14. description: "Kernel Patches Commit"
  15. value: ${{ steps.commits.outputs.patches_commit }}
  16. susfs_commit:
  17. description: "SUSFS Commit (Map)"
  18. value: ${{ steps.commits.outputs.susfs_commit }}
  19. bbg_commit:
  20. description: "BBG Commit"
  21. value: ${{ steps.commits.outputs.bbg_commit }}
  22. runs:
  23. using: "composite"
  24. steps:
  25. - name: Get Latest Commits
  26. id: commits
  27. shell: bash
  28. run: |
  29. # ============================================================================
  30. # HARDCODE SECTION: KernelSU-Next (KSUN) Commit
  31. # ============================================================================
  32. # To use a specific KSU commit, uncomment and set the value below:
  33. # HARDCODED_KSU_COMMIT="abc123def456" # e.g., a full commit SHA or ref like "dev"
  34. HARDCODED_KSU_COMMIT=""
  35. # ============================================================================
  36. # HARDCODE SECTION: SUSFS Commits (branch:commit format)
  37. # ============================================================================
  38. # To use specific SUSFS commits, uncomment and set the values below:
  39. # Format: branch1:commit1,branch2:commit2,...
  40. # Example: HARDCODED_SUSFS_MAP="gki-android14-5.15:abc123,gki-android14-6.1:def456"
  41. HARDCODED_SUSFS_MAP=""
  42. # ============================================================================
  43. # Helper functions
  44. # ============================================================================
  45. # Helper to get latest commit from remote without cloning full repo
  46. get_commit() {
  47. git ls-remote "$1" "$2" | awk '{print $1}'
  48. }
  49. get_tag_for_commit() {
  50. repo="$1"
  51. commit="$2"
  52. git ls-remote --tags "$repo" | awk -v c="$commit" '$1==c && $2 ~ /^refs\/tags\// {print $2}' \
  53. | sed -E 's#^refs/tags/##; s#\^\{\}$##' \
  54. | sort -V \
  55. | tail -n 1
  56. }
  57. echo "Fetching latest commits..."
  58. # KernelSU-Next
  59. if [ -n "$HARDCODED_KSU_COMMIT" ]; then
  60. ksu_commit="$HARDCODED_KSU_COMMIT"
  61. echo "Using hardcoded KernelSU-Next commit: $ksu_commit"
  62. else
  63. ksu_commit=$(get_commit "https://github.com/KernelSU-Next/KernelSU-Next.git" "refs/heads/dev")
  64. echo "KernelSU-Next: $ksu_commit"
  65. fi
  66. echo "ksu_commit=$ksu_commit" >> $GITHUB_OUTPUT
  67. KSUN_TAG="$(get_tag_for_commit "https://github.com/KernelSU-Next/KernelSU-Next.git" "$ksu_commit")"
  68. echo "KernelSU-Next Tag: ${KSUN_TAG:-None}"
  69. echo "ksu_tag=$KSUN_TAG" >> $GITHUB_OUTPUT
  70. # AnyKernel3
  71. AK3_COMMIT=$(get_commit "https://github.com/WildKernels/AnyKernel3.git" "refs/heads/gki-2.0")
  72. echo "AnyKernel3: $AK3_COMMIT"
  73. echo "anykernel_commit=$AK3_COMMIT" >> $GITHUB_OUTPUT
  74. # Kernel Patches
  75. PATCHES_COMMIT=$(get_commit "https://github.com/WildKernels/kernel_patches.git" "HEAD")
  76. echo "Kernel Patches: $PATCHES_COMMIT"
  77. echo "patches_commit=$PATCHES_COMMIT" >> $GITHUB_OUTPUT
  78. # SUSFS (using gitlab) - Fetch all relevant branches
  79. SUSFS_REPO="https://gitlab.com/simonpunk/susfs4ksu.git"
  80. echo "Fetching SUSFS commits for all branches..."
  81. # We need to construct a JSON object or a simple string map
  82. # Format: branch1:commit1,branch2:commit2,...
  83. if [ -n "$HARDCODED_SUSFS_MAP" ]; then
  84. echo "Using hardcoded SUSFS commit map: $HARDCODED_SUSFS_MAP"
  85. SUSFS_MAP="$HARDCODED_SUSFS_MAP"
  86. else
  87. BRANCHES=(
  88. "gki-android12-5.10"
  89. "gki-android13-5.10"
  90. "gki-android13-5.15"
  91. "gki-android14-5.15"
  92. "gki-android14-6.1"
  93. "gki-android15-6.6"
  94. "gki-android16-6.12"
  95. )
  96. SUSFS_MAP=""
  97. for branch in "${BRANCHES[@]}"; do
  98. COMMIT=$(get_commit "$SUSFS_REPO" "refs/heads/$branch")
  99. if [ -n "$COMMIT" ]; then
  100. echo " $branch: $COMMIT"
  101. if [ -z "$SUSFS_MAP" ]; then
  102. SUSFS_MAP="$branch:$COMMIT"
  103. else
  104. SUSFS_MAP="$SUSFS_MAP,$branch:$COMMIT"
  105. fi
  106. else
  107. echo " $branch: Not found"
  108. fi
  109. done
  110. fi
  111. echo "susfs_commit=$SUSFS_MAP" >> $GITHUB_OUTPUT
  112. # BBG
  113. BBG_COMMIT=$(get_commit "https://github.com/vc-teahouse/Baseband-guard.git" "refs/heads/main")
  114. echo "BBG: $BBG_COMMIT"
  115. echo "bbg_commit=$BBG_COMMIT" >> $GITHUB_OUTPUT