浏览代码

ci: link official KernelSU-Next manager run for fork sync point

pershoot/KernelSU-Next has all workflows disabled_manually (zero runs), so
the manager link always fell back to a dead workflow page. The manager is
actually built on the official KernelSU-Next/KernelSU-Next repo.

Match pershoot's dev-susfs branch against the official dev branch
(intentionally ignoring pershoot's own dev branch): fetch official dev,
take the merge-base as the stock commit the fork is synced with, then
query the official build-manager-ci.yml runs by that head_sha and link the
run. Falls back to the official workflow page (which is live) if no run
exists for that commit.
TheWildJames 1 月之前
父节点
当前提交
3dce04b6e7
共有 1 个文件被更改,包括 24 次插入3 次删除
  1. 24 3
      .github/workflows/main.yml

+ 24 - 3
.github/workflows/main.yml

@@ -524,11 +524,32 @@ jobs:
         # Extract git tag
         KSU_GIT_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "no-tag")
 
-        MANAGER_RUN_ID=$(curl -fsSL "https://api.github.com/repos/pershoot/KernelSU-Next/actions/workflows/build-manager-ci.yml/runs?head_sha=${KSUN_COMMIT}" | jq -r '.workflow_runs[0].id // empty')
+        # The manager is built on the OFFICIAL KernelSU-Next repo
+        # (pershoot's workflows are all disabled). Find the official dev
+        # commit this fork's branch is synced with (merge-base of our
+        # branch vs official dev), then link the manager build run for
+        # that commit. pershoot's own dev branch is intentionally ignored.
+        retry() {
+          local n=0
+          until [ "$n" -ge 5 ]; do
+            "$@" && return 0
+            n=$((n+1))
+            echo "retry $n/5 failed for: $*" >&2
+            sleep 5
+          done
+          return 1
+        }
+
+        OFFICIAL_KSU_REPO="https://github.com/KernelSU-Next/KernelSU-Next.git"
+        retry git fetch "$OFFICIAL_KSU_REPO" dev
+        STOCK_COMMIT=$(git merge-base HEAD FETCH_HEAD)
+        echo "KSU Stock Commit (official sync point): $STOCK_COMMIT"
+
+        MANAGER_RUN_ID=$(curl -fsSL --retry 5 --retry-delay 5 --retry-all-errors "https://api.github.com/repos/KernelSU-Next/KernelSU-Next/actions/workflows/build-manager-ci.yml/runs?head_sha=${STOCK_COMMIT}" | jq -r '.workflow_runs[0].id // empty')
         if [[ -n "${MANAGER_RUN_ID:-}" ]]; then
-          KSU_MANAGER="https://github.com/pershoot/KernelSU-Next/actions/runs/${MANAGER_RUN_ID}"
+          KSU_MANAGER="https://github.com/KernelSU-Next/KernelSU-Next/actions/runs/${MANAGER_RUN_ID}"
         else
-          KSU_MANAGER="https://github.com/pershoot/KernelSU-Next/actions/workflows/build-manager-ci.yml"
+          KSU_MANAGER="https://github.com/KernelSU-Next/KernelSU-Next/actions/workflows/build-manager-ci.yml"
         fi
 
         echo "Commits count: $COMMITS_COUNT"