action.yml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. name: Fetch Latest Commits
  2. description: "Fetches the latest commit hashes for Wild KSU, AnyKernel3, Kernel Patches, and SUSFS"
  3. inputs:
  4. ksu_commit:
  5. description: "Optional: Specific Wild KSU commit to use"
  6. required: false
  7. default: ""
  8. outputs:
  9. ksu_commit:
  10. description: "Wild KSU Commit"
  11. value: ${{ steps.commits.outputs.ksu_commit }}
  12. anykernel_commit:
  13. description: "AnyKernel3 Commit"
  14. value: ${{ steps.commits.outputs.anykernel_commit }}
  15. patches_commit:
  16. description: "Kernel Patches Commit"
  17. value: ${{ steps.commits.outputs.patches_commit }}
  18. susfs_commit:
  19. description: "SUSFS Commit (Map)"
  20. value: ${{ steps.commits.outputs.susfs_commit }}
  21. runs:
  22. using: "composite"
  23. steps:
  24. - name: Get Latest Commits
  25. id: commits
  26. shell: bash
  27. run: |
  28. # Helper to get latest commit from remote without cloning full repo
  29. get_commit() {
  30. git ls-remote "$1" "$2" | awk '{print $1}'
  31. }
  32. echo "Fetching latest commits..."
  33. # Wild KSU
  34. if [ -n "${{ inputs.ksu_commit }}" ]; then
  35. # Try to resolve input as a ref (branch/tag)
  36. resolved_commit=$(get_commit "https://github.com/WildKernels/Wild_KSU.git" "${{ inputs.ksu_commit }}")
  37. if [ -n "$resolved_commit" ]; then
  38. ksu_commit="$resolved_commit"
  39. else
  40. # If resolution failed, assume input is a commit SHA
  41. ksu_commit="${{ inputs.ksu_commit }}"
  42. fi
  43. echo "Using provided Wild KSU commit: $ksu_commit"
  44. else
  45. ksu_commit=$(get_commit "https://github.com/WildKernels/Wild_KSU.git" "refs/heads/canary")
  46. echo "Wild KSU: $ksu_commit"
  47. fi
  48. echo "ksu_commit=$ksu_commit" >> $GITHUB_OUTPUT
  49. # AnyKernel3
  50. AK3_COMMIT=$(get_commit "https://github.com/WildKernels/AnyKernel3.git" "refs/heads/gki-2.0")
  51. echo "AnyKernel3: $AK3_COMMIT"
  52. echo "anykernel_commit=$AK3_COMMIT" >> $GITHUB_OUTPUT
  53. # Kernel Patches
  54. PATCHES_COMMIT=$(get_commit "https://github.com/WildKernels/kernel_patches.git" "HEAD")
  55. echo "Kernel Patches: $PATCHES_COMMIT"
  56. echo "patches_commit=$PATCHES_COMMIT" >> $GITHUB_OUTPUT
  57. # SUSFS (using gitlab) - Fetch all relevant branches
  58. SUSFS_REPO="https://gitlab.com/simonpunk/susfs4ksu.git"
  59. echo "Fetching SUSFS commits for all branches..."
  60. # We need to construct a JSON object or a simple string map
  61. # Format: branch1:commit1,branch2:commit2,...
  62. BRANCHES=(
  63. "gki-android12-5.10"
  64. "gki-android13-5.10"
  65. "gki-android13-5.15"
  66. "gki-android14-5.15"
  67. "gki-android14-6.1"
  68. "gki-android15-6.6"
  69. "gki-android16-6.12"
  70. )
  71. SUSFS_MAP=""
  72. for branch in "${BRANCHES[@]}"; do
  73. COMMIT=$(get_commit "$SUSFS_REPO" "refs/heads/$branch")
  74. if [ -n "$COMMIT" ]; then
  75. echo " $branch: $COMMIT"
  76. if [ -z "$SUSFS_MAP" ]; then
  77. SUSFS_MAP="$branch:$COMMIT"
  78. else
  79. SUSFS_MAP="$SUSFS_MAP,$branch:$COMMIT"
  80. fi
  81. else
  82. echo " $branch: Not found"
  83. fi
  84. done
  85. echo "susfs_commit=$SUSFS_MAP" >> $GITHUB_OUTPUT