diff --git a/.gitea/workflows/codeant.yml b/.gitea/workflows/codeant.yml index 55a858c..2c8d668 100644 --- a/.gitea/workflows/codeant.yml +++ b/.gitea/workflows/codeant.yml @@ -96,14 +96,39 @@ jobs: if [ "${GITHUB_EVENT_NAME}" = "pull_request" ] && [ -n "${GITHUB_BASE_REF}" ]; then echo "Running PR review against base branch: ${GITHUB_BASE_REF}" - for attempt in 1 2 3; do - echo "PR review attempt $attempt/3" - codeant review --base "${GITHUB_BASE_REF}" --exclude "${REVIEW_EXCLUDES}" 2>&1 | tee review.txt || true - if ! grep -q "Unexpected token '<'" review.txt; then - break + git fetch origin "${GITHUB_BASE_REF}" --depth=1 || true + + CHANGED_FILES=$(git diff --name-only "origin/${GITHUB_BASE_REF}...HEAD" | grep '^.gitea/workflows/src/' | grep -v '^.gitea/workflows/codeant.yml' || true) + + if [ -z "${CHANGED_FILES}" ]; then + echo "No source files changed in PR scope." | tee review.txt + exit 0 + fi + + echo "Files to review:" + echo "${CHANGED_FILES}" + + FAILED=0 + : > review.txt + while IFS= read -r file; do + [ -z "$file" ] && continue + echo "--- Reviewing: $file ---" | tee -a review.txt + codeant review --base "${GITHUB_BASE_REF}" --include "$file" --exclude "${REVIEW_EXCLUDES}" 2>&1 | tee -a review.txt || true + + if grep -q "Unexpected token '<'\|HTTP error 403" review.txt; then + FAILED=1 + echo "Transient API failure detected for $file; continuing to next file." | tee -a review.txt fi - sleep $((attempt * 15)) - done + + # Pace requests to avoid backend throttling on CI runners. + sleep 12 + done <(null); useEffect(() => { - console.log('LearningFacility component mounted'); // Debug log window.scrollTo(0, 0); // Listen for custom booking modal event from CTAPopupModal const handleOpenBookingModal = () => { - console.log('Custom booking modal event received'); // Debug log handleBookNow(); }; @@ -403,7 +401,6 @@ export function LearningFacilityNew() { // Also check if we should auto-open the booking modal based on URL parameters const urlParams = new URLSearchParams(window.location.search); if (urlParams.get('autoBooking') === 'true') { - console.log('Auto-opening booking modal from URL parameter'); // Debug log setTimeout(() => handleBookNow(), 100); } @@ -1850,7 +1847,6 @@ function BookingModal({ const handleFormSubmit = (e: React.FormEvent) => { e.preventDefault(); - console.log('Booking form submitted:', bookingForm); // Here you would typically send the form data to your backend alert('Booking request submitted successfully! We will contact you soon.'); onClose(); diff --git a/.gitea/workflows/src/utils/getReadingTime.ts b/.gitea/workflows/src/utils/getReadingTime.ts index 8b01a10..54eaee3 100644 --- a/.gitea/workflows/src/utils/getReadingTime.ts +++ b/.gitea/workflows/src/utils/getReadingTime.ts @@ -2,7 +2,7 @@ export const getReadingTime = (text: string): string => { if (!text) return "0 min read"; // Remove HTML tags if present - const cleanText = text.replace(/<[^>]+>/g, ""); + const cleanText = text.replace(/<[^>]+>/g, "").replace(/ /gi, " "); if (!cleanText.trim()) return "0 min read"; // Count words diff --git a/.gitea/workflows/src/utils/urlHelpers.ts b/.gitea/workflows/src/utils/urlHelpers.ts index 9f5a27d..1f3b513 100644 --- a/.gitea/workflows/src/utils/urlHelpers.ts +++ b/.gitea/workflows/src/utils/urlHelpers.ts @@ -18,8 +18,14 @@ export const createSlug = (text: string): string => { * Example: "Ad ut neque enim omn", "e7d611b6-853b-4785-b508-599eeed2af92" -> "ad-ut-neque-enim-omn-e7d611b6-853b-4785-b508-599eeed2af92" */ export const getSlugWithId = (title: string, id: string) => { + const slug = createSlug(title); const normalizedId = id.trim(); - return `${createSlug(title)}-${normalizedId}`; + + if (!slug && !normalizedId) return ''; + if (!slug) return normalizedId; + if (!normalizedId) return slug; + + return `${slug}-${normalizedId}`; }; /**