| name: Auto-Sync Products | |
| on: | |
| schedule: | |
| # Chạy hàng ngày lúc midnight UTC (8:00 AM Việt Nam) | |
| - cron: '0 0 * * *' | |
| workflow_dispatch: | |
| inputs: | |
| dry_run: | |
| description: 'Chỉ kiểm tra mà không cập nhật' | |
| type: boolean | |
| default: false | |
| target_space: | |
| description: 'Không gian target (vai-avatar2 hoặc both)' | |
| type: choice | |
| options: | |
| - vai-avatar2 | |
| - both | |
| jobs: | |
| sync-products: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: | | |
| pip install huggingface_hub | |
| - name: Run sync products | |
| env: | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| run: | | |
| echo "Starting product auto-sync..." | |
| python3 sync_products.py | |
| if [ $? -eq 0 ]; then | |
| echo "✅ Sync completed successfully" | |
| else | |
| echo "❌ Sync failed" | |
| exit 1 | |
| fi | |