Răsfoiți Sursa

fix: enhance upload process with detailed logging and retry mechanism

TheWildJames 3 luni în urmă
părinte
comite
6c35bb640e
1 a modificat fișierele cu 16 adăugiri și 3 ștergeri
  1. 16 3
      .github/actions/cache-save/action.yml

+ 16 - 3
.github/actions/cache-save/action.yml

@@ -111,20 +111,33 @@ runs:
             local max_attempts=3
             for ((i=1; i<=max_attempts; i++)); do
               echo "  Attempt $i for $file..."
+              local upload_log
+              upload_log=$(mktemp)
               
               if [ "${{ inputs.debug }}" = "true" ]; then
-                if timeout 10m gh release upload "$TAG_NAME" "$file" --clobber --repo "$TARGET_REPO"; then
+                if timeout 10m gh release upload "$TAG_NAME" "$file" --clobber --repo "$TARGET_REPO" > >(tee "$upload_log") 2> >(tee -a "$upload_log" >&2); then
+                  rm -f "$upload_log"
                   echo "  Successfully uploaded $file"
                   return 0
                 fi
               else
-                if timeout 10m gh release upload "$TAG_NAME" "$file" --clobber --repo "$TARGET_REPO" > /dev/null 2>&1; then
+                if timeout 10m gh release upload "$TAG_NAME" "$file" --clobber --repo "$TARGET_REPO" > "$upload_log" 2>&1; then
+                  rm -f "$upload_log"
                   echo "  Successfully uploaded $file"
                   return 0
                 fi
               fi
               
-              echo "  ⚠ Attempt $i failed or timed out. Retrying..."
+              local exit_code=$?
+              echo "  ⚠ Attempt $i failed with exit code $exit_code."
+              echo "  └─ Upload output for $file:"
+              sed 's/^/    /' "$upload_log" || true
+              rm -f "$upload_log"
+              if [ "$exit_code" -eq 124 ]; then
+                echo "  ⚠ Attempt $i timed out after 10m. Retrying..."
+              else
+                echo "  ⚠ Attempt $i failed. Retrying..."
+              fi
               sleep 5
             done
             return 1