πŸ”„ Add auto-sync: daily product sync from master dataset to both storefronts

#28
by bep40 - opened

Auto-Sync Infrastructure - Pull Request

Purpose

Automate nightly sync (~23,400 products) from central master dataset (bep40/grob-products-updated) to both HuggingFace storefront spaces:

  • V.AISTUDIO (primary storefront)
  • vai-avatar2 (secondary storefront)

Files Added

  1. sync_products.py - Python script that:

    • Loads latest product data from HF dataset bep40/grob-products-updated
    • Computes diff against existing cached products
    • Uploads ONLY new/updated products to both spaces
    • Triggers Space rebuild via .gitignore touch for cache busting
  2. .github/workflows/auto-sync.yml - GitHub Actions workflow that:

    • Runs daily at 00:00 UTC via cron schedule
    • Uses actions/setup-python@v5 for Python environment
    • Installs dependencies: huggingface_hub, datasets
    • Executes python3 sync_products.py
    • Includes proper error handling and logging

How It Works

malloca.com update β†’ HF Dataset updated β†’ Cron triggers β†’ 
Python sync script diffs β†’ Pushes NEW products only β†’ 
Triggers Space rebuild on BOTH spaces

Requirements

  • HF_TOKEN secret must be configured in Repo Settings β†’ Secrets & variables β†’ Actions
  • Token needs write scope for both bep40/V.AISTUDIO and bep40/vai-avatar2 spaces

Key Features

  • βœ… Incremental sync: Only uploads changed/new products (slug-based diff detection)
  • βœ… Cache-busting: Touches .gitignore to force Space rebuild after sync
  • βœ… Image download & upload: Downloads product images from source URLs
  • βœ… Error handling: Logs warnings for failed image downloads without breaking sync
  • βœ… Progress tracking: Updates every 50 products during upload
  • βœ… Minimal payload: Optimized HTML templates for fast rendering
    "
bep40 changed pull request status to open
Ready to merge
This branch is ready to get merged automatically.

Sign up or log in to comment