action.yml 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. name: 'Setup SUSFS Branch'
  2. description: 'Clone SUSFS repo and cherry-pick commits'
  3. inputs:
  4. susfs_commit:
  5. description: 'SUSFS commit hash (empty = latest on auto-derived gki-{version} branch)'
  6. required: false
  7. default: ""
  8. version:
  9. description: 'Kernel config version (e.g., android15-6.6)'
  10. required: true
  11. root_flavor:
  12. description: 'Selected root implementation - pershoot patches only apply to next'
  13. required: false
  14. default: ""
  15. runs:
  16. using: "composite"
  17. steps:
  18. - name: Clone SUSFS Branch
  19. shell: bash
  20. run: |
  21. set -euo pipefail
  22. # Retry transient network errors (up to 5 attempts, 5s backoff).
  23. retry() {
  24. local n=0
  25. until [ "$n" -ge 5 ]; do
  26. "$@" && return 0
  27. n=$((n+1))
  28. echo "retry $n/5 failed for: $*" >&2
  29. sleep 5
  30. done
  31. return 1
  32. }
  33. SUSFS_BRANCH="gki-${{ inputs.version }}"
  34. SUSFS_REPO="https://gitlab.com/simonpunk/susfs4ksu.git"
  35. echo "Preparing SUSFS for branch: $SUSFS_BRANCH"
  36. echo "Cloning latest from $SUSFS_BRANCH..."
  37. retry git clone "$SUSFS_REPO" -b "$SUSFS_BRANCH" susfs4ksu
  38. if [ -n "${{ inputs.susfs_commit }}" ]; then
  39. echo "Checking out SUSFS commit: ${{ inputs.susfs_commit }}"
  40. retry git -C "${{ github.workspace }}/susfs4ksu" checkout "${{ inputs.susfs_commit }}"
  41. fi
  42. cd "${{ github.workspace }}/susfs4ksu"
  43. SUSFS_COMMIT="$(git rev-parse HEAD)"
  44. echo "SUSFS_COMMIT=$SUSFS_COMMIT" >> "$GITHUB_ENV"
  45. echo "Using SUSFS commit: $SUSFS_COMMIT"
  46. # Pershoot's latest two gki-android14-6.1-dev commits (currently the
  47. # no-features core build + Toolkit coexistence fixes) only apply to
  48. # KernelSU-Next (dev-susfs fork). Other flavors use the simonpunk
  49. # checkout as-is.
  50. if [ "${{ inputs.root_flavor }}" = "next" ]; then
  51. git fetch https://gitlab.com/pershoot/susfs4ksu.git gki-android14-6.1-dev || true
  52. git log ..FETCH_HEAD --oneline -n 2 | awk '{print $1}' | tac | xargs git cherry-pick 2>/dev/null || true
  53. fi