name: Sync to Hugging Face hub on: push: branches: [main] # to run this workflow manually from the Actions tab workflow_dispatch: jobs: sync-to-hub: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Configure Git run: | git config --global user.name "GitHub Action" git config --global user.email "action@github.com" - name: Prepend frontmatter to README run: | if [ -f README.md ] && ! grep -q "^---" README.md; then FRONTMATTER="--- title: marimo learn emoji: 🧠 colorFrom: blue colorTo: indigo sdk: docker sdk_version: \"latest\" app_file: app.py pinned: false --- " echo "$FRONTMATTER$(cat README.md)" > README.md git add README.md git commit -m "Add HF frontmatter to README" || echo "No changes to commit" fi - name: Push to hub env: HF_TOKEN: ${{ secrets.HF_TOKEN }} run: git push -f https://mylessss:$HF_TOKEN@huggingface.co/spaces/marimo-team/marimo-learn main