name: Build and Deploy Chat Demo on: push: branches: [ main ] pull_request: permissions: contents: read jobs: build: name: Lint, Test, and Validate runs-on: ubuntu-latest steps: - name: Checkout Repository uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.11' - name: Install dependencies run: | python -m pip install --upgrade pip pip install -r requirements.txt - name: Lint and Style Check run: | pip install flake8 pylint flake8 . --max-line-length=100 --statistics pylint $(git ls-files '*.py') --score=n || true - name: Smoke Test run: | python - <<'PYCODE' import importlib.util spec = importlib.util.spec_from_file_location("app", "app.py") if spec is None: raise SystemExit("app.py not found") print("✅ Import test OK") PYCODE deploy: if: github.ref == 'refs/heads/main' needs: build runs-on: ubuntu-latest steps: - name: Trigger Hugging Face Space rebuild env: HF_TOKEN: ${{ secrets.HF_TOKEN }} run: | curl -X POST \ -H "Authorization: Bearer $HF_TOKEN" \ https://huggingface.co/api/spaces/YOUR_USERNAME/YOUR_SPACE_ID/restart