Jelajahi Sumber

ci(cache-save): add verbose debug on upload failure

Log file size/tag/repo per attempt, capture gh output, show exit code
(124=timeout), GH_TOKEN/tag state, gh auth status, and full log between
markers even when debug=false so next android14-6.1 failure explains why
KernelSU-Next.tzst upload failed after 3 attempts

Co-Authored-By: internal-model
TheWildJames 1 Minggu lalu
induk
melakukan
71088cdb01
1 mengubah file dengan 26 tambahan dan 8 penghapusan
  1. 26 8
      .github/actions/cache-save/action.yml

+ 26 - 8
.github/actions/cache-save/action.yml

@@ -133,19 +133,37 @@ runs:
             local max_attempts=3
             for ((i=1; i<=max_attempts; i++)); do
               echo "  Attempt $i for $file..."
+              echo "  File: $file ($(stat -c%s "$file" 2>/dev/null || echo "?") bytes) -> tag $TAG_NAME repo $TARGET_REPO"
               
+              set +e
+              tmp_log=$(mktemp)
               if [ "${{ inputs.debug }}" = "true" ]; then
-                if timeout 10m gh release upload "$TAG_NAME" "$file" --clobber --repo "$TARGET_REPO"; then
-                  echo "  Successfully uploaded $file"
-                  return 0
-                fi
+                set -x
+                timeout 10m gh release upload "$TAG_NAME" "$file" --clobber --repo "$TARGET_REPO" 2>&1 | tee "$tmp_log"; rc=${PIPESTATUS[0]}
+                set +x
               else
-                if timeout 10m gh release upload "$TAG_NAME" "$file" --clobber --repo "$TARGET_REPO" > /dev/null 2>&1; then
-                  echo "  Successfully uploaded $file"
-                  return 0
-                fi
+                timeout 10m gh release upload "$TAG_NAME" "$file" --clobber --repo "$TARGET_REPO" >"$tmp_log" 2>&1; rc=$?
+                cat "$tmp_log"
               fi
+              set -e
               
+              if [ $rc -eq 0 ]; then
+                echo "  Successfully uploaded $file"
+                rm -f "$tmp_log"
+                return 0
+              fi
+              
+              if [ $rc -eq 124 ]; then
+                echo "  ⚠ Attempt $i timed out after 10m (timeout exit 124)"
+              else
+                echo "  ⚠ Attempt $i failed with exit $rc"
+              fi
+              echo "  --- gh upload log ---"
+              cat "$tmp_log" || true
+              echo "  --- end log ---"
+              rm -f "$tmp_log"
+              echo "  GH_TOKEN set: $([ -n "$GH_TOKEN" ] && echo yes || echo no) | tag exists: $(git rev-parse "$TAG_NAME" >/dev/null 2>&1 && echo yes || echo no)"
+              gh auth status 2>&1 | head -n 20 || true
               echo "  ⚠ Attempt $i failed or timed out. Retrying..."
               sleep 5
             done