Skip to content

Commit f4929e9

Browse files
committed
Fix GraphQL query issue and add strict checks
1 parent 3bf541d commit f4929e9

2 files changed

Lines changed: 10 additions & 16 deletions

File tree

.github/actions/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -610,8 +610,8 @@ runs:
610610
611611
# Determine which SUSFS ref to use
612612
KERNEL_KEY="${{ env.ANDROID_VER }}-${{ env.KERNEL_VER }}"
613-
if [ -z "$SUSFS_INPUT" ] || [ "$SUSFS_INPUT" = "next" ] || [ "$SUSFS_INPUT" = "unknown" ]; then
614-
# Empty, "next" or "unknown": use kernel-specific default
613+
if [ -z "$SUSFS_INPUT" ]; then
614+
# use kernel-specific default
615615
SUSFS_BRANCH="${DEFAULT_SUSFS[$KERNEL_KEY]:-gki-android15-6.6}"
616616
echo "ℹ️ Using default SUSFS branch for $KERNEL_KEY: $SUSFS_BRANCH"
617617
else

.github/workflows/build-kernel-release.yml

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ jobs:
190190
repository(owner: $owner, name: $name) {
191191
hb: ref(qualifiedName: "refs/heads/" $ref) { t: target { ... on Commit { o: oid } } }
192192
ht: ref(qualifiedName: "refs/tags/" $ref) { t: target { ... on Commit { o: oid } } }
193-
hr: ref(qualifiedName: $ref) { t: target { ... on Commit { o: oid } } }
193+
ho: object(expression: $ref) { ... on Commit { o: oid } }
194194
}
195195
}'
196196
@@ -215,24 +215,18 @@ jobs:
215215
done
216216
217217
if [ $RETRY_COUNT -eq $MAX_RETRIES ]; then
218-
echo "::error::Failed to resolve $ksu_type hash after $MAX_RETRIES attempts."
219-
# Optional: Fallback to passthrough if it looks like a SHA, otherwise fail
220-
if [[ "$ksu_ref" =~ ^[0-9a-f]{40}$ ]]; then
221-
resolved_sha="$ksu_ref"
222-
else
223-
exit 1
224-
fi
225-
else
226-
# 6. Parse result if successful
227-
resolved_sha=$(echo "$RESULT" | jq -r '.data.repository | (.hb.t.o // .ht.t.o // .hr.t.o // "unknown")')
218+
echo "::error::GitHub API unreachable. Cannot validate $ksu_ref"
219+
exit 1
228220
fi
229221
230-
if [[ "$resolved_sha" == "unknown" && "$ksu_ref" =~ ^[0-9a-f]{40}$ ]]; then
231-
resolved_sha="$ksu_ref"
222+
resolved_sha=$(echo "$RESULT" | jq -r '.data.repository | (.hb.t.o // .ht.t.o // .ho.o // "unknown")')
223+
224+
if [ "$resolved_sha" == "unknown" ]; then
225+
echo "::error::Ref/Hash '$ksu_ref' does not exist in $KSU_REPO_OWNER/$KSU_REPO_NAME"
226+
exit 1
232227
fi
233228
234229
echo " ✅ Resolved: $ksu_type/$ksu_ref → $resolved_sha"
235-
236230
echo "ksu_resolved_hash=$resolved_sha" >> "$GITHUB_OUTPUT"
237231
238232

0 commit comments

Comments
 (0)