github_sync / .github /workflows /push_to_hf_space.yml
Wagtail
add scikit-learn and Update push_to_hf_space.yml
ec00a3f unverified
name: Sync to Hugging Face hub
on:
push:
branches: [main]
workflow_dispatch:
jobs:
sync-to-hub:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
lfs: true
# -------------------------
# 1. Set up Python
# -------------------------
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
# -------------------------
# 2. Install dependencies
# -------------------------
- name: Install dependencies
run: |
pip install --upgrade pip
pip install flake8 nbqa pytest pandas scikit-learn
# -------------------------
# 3. Lint Python files
# -------------------------
- name: Lint .py files
run: |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# -------------------------
# 4. Lint notebooks with nbQA
# -------------------------
- name: Lint notebooks
run: |
nbqa flake8 . --exclude A2,A3 --extend-ignore=F821 --select=E9,F63,F7,F82 --statistics
# -------------------------
# 5. Block problematic files
# -------------------------
- name: Check for restricted file types
run: |
if git diff --name-only HEAD~1 | grep -E '\.(pdf|xlsx)$'; then
echo "❌ PDF/XLSX files detected. These break HuggingFace sync."
exit 1
fi
# -------------------------
# 6. Run unit tests
# -------------------------
- name: Run unit tests
run: |
pytest A4/ -v --tb=short
# -------------------------
# 7. Push to HuggingFace
# -------------------------
- name: Push to hub
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
git push -f https://Bachstelze:$HF_TOKEN@huggingface.co/spaces/Bachstelze/github_sync main