| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- name: Fetch Latest Commits
- description: "Fetches the latest commit hashes for KernelSU-Next, AnyKernel3, Kernel Patches, SUSFS, and BBG"
- inputs:
- ksu_commit:
- description: "Optional: Specific KernelSU-Next ref/commit to use"
- required: false
- default: ""
- outputs:
- ksu_commit:
- description: "KernelSU-Next Commit"
- value: ${{ steps.commits.outputs.ksu_commit }}
- ksu_tag:
- description: "KernelSU-Next Tag (best effort)"
- value: ${{ steps.commits.outputs.ksu_tag }}
- anykernel_commit:
- description: "AnyKernel3 Commit"
- value: ${{ steps.commits.outputs.anykernel_commit }}
- patches_commit:
- description: "Kernel Patches Commit"
- value: ${{ steps.commits.outputs.patches_commit }}
- susfs_commit:
- description: "SUSFS Commit (Map)"
- value: ${{ steps.commits.outputs.susfs_commit }}
- bbg_commit:
- description: "BBG Commit"
- value: ${{ steps.commits.outputs.bbg_commit }}
- runs:
- using: "composite"
- steps:
- - name: Get Latest Commits
- id: commits
- shell: bash
- run: |
- # Helper to get latest commit from remote without cloning full repo
- get_commit() {
- git ls-remote "$1" "$2" | awk '{print $1}'
- }
-
- get_tag_for_commit() {
- repo="$1"
- commit="$2"
- git ls-remote --tags "$repo" | awk -v c="$commit" '$1==c && $2 ~ /^refs\/tags\// {print $2}' \
- | sed -E 's#^refs/tags/##; s#\^\{\}$##' \
- | sort -V \
- | tail -n 1
- }
- echo "Fetching latest commits..."
-
- # KernelSU-Next
- if [ -n "${{ inputs.ksu_commit }}" ]; then
- input_ref="${{ inputs.ksu_commit }}"
- resolved_commit="$(get_commit "https://github.com/KernelSU-Next/KernelSU-Next.git" "$input_ref")"
- if [ -z "$resolved_commit" ]; then
- resolved_commit="$(get_commit "https://github.com/KernelSU-Next/KernelSU-Next.git" "refs/heads/$input_ref")"
- fi
- if [ -z "$resolved_commit" ]; then
- resolved_commit="$(get_commit "https://github.com/KernelSU-Next/KernelSU-Next.git" "refs/tags/$input_ref")"
- fi
-
- if [ -n "$resolved_commit" ]; then
- ksu_commit="$resolved_commit"
- else
- # If resolution failed, assume input is a commit SHA
- ksu_commit="$input_ref"
- fi
- echo "Using provided KernelSU-Next commit: $ksu_commit"
- else
- ksu_commit=$(get_commit "https://github.com/KernelSU-Next/KernelSU-Next.git" "refs/heads/dev")
- echo "KernelSU-Next: $ksu_commit"
- fi
- echo "ksu_commit=$ksu_commit" >> $GITHUB_OUTPUT
-
- KSUN_TAG="$(get_tag_for_commit "https://github.com/KernelSU-Next/KernelSU-Next.git" "$ksu_commit")"
- echo "KernelSU-Next Tag: ${KSUN_TAG:-None}"
- echo "ksu_tag=$KSUN_TAG" >> $GITHUB_OUTPUT
-
- # AnyKernel3
- AK3_COMMIT=$(get_commit "https://github.com/WildKernels/AnyKernel3.git" "refs/heads/gki-2.0")
- echo "AnyKernel3: $AK3_COMMIT"
- echo "anykernel_commit=$AK3_COMMIT" >> $GITHUB_OUTPUT
-
- # Kernel Patches
- PATCHES_COMMIT=$(get_commit "https://github.com/WildKernels/kernel_patches.git" "HEAD")
- echo "Kernel Patches: $PATCHES_COMMIT"
- echo "patches_commit=$PATCHES_COMMIT" >> $GITHUB_OUTPUT
-
- # SUSFS (using gitlab) - Fetch all relevant branches
- SUSFS_REPO="https://gitlab.com/simonpunk/susfs4ksu.git"
- echo "Fetching SUSFS commits for all branches..."
-
- # We need to construct a JSON object or a simple string map
- # Format: branch1:commit1,branch2:commit2,...
-
- BRANCHES=(
- "gki-android12-5.10"
- "gki-android13-5.10"
- "gki-android13-5.15"
- "gki-android14-5.15"
- "gki-android14-6.1"
- "gki-android15-6.6"
- "gki-android16-6.12"
- )
-
- SUSFS_MAP=""
- for branch in "${BRANCHES[@]}"; do
- COMMIT=$(get_commit "$SUSFS_REPO" "refs/heads/$branch")
- if [ -n "$COMMIT" ]; then
- echo " $branch: $COMMIT"
- if [ -z "$SUSFS_MAP" ]; then
- SUSFS_MAP="$branch:$COMMIT"
- else
- SUSFS_MAP="$SUSFS_MAP,$branch:$COMMIT"
- fi
- else
- echo " $branch: Not found"
- fi
- done
-
- echo "susfs_commit=$SUSFS_MAP" >> $GITHUB_OUTPUT
-
- # BBG
- BBG_COMMIT=$(get_commit "https://github.com/vc-teahouse/Baseband-guard.git" "refs/heads/main")
- echo "BBG: $BBG_COMMIT"
- echo "bbg_commit=$BBG_COMMIT" >> $GITHUB_OUTPUT
|