commit 8d8eaa93e3b29569723ec6bc684b9c64f67434c6 parent 0a382ebb90452cbf177cca4b0ebe57bc308712fc Author: Amit Dutta <mail@amit.is-a.dev> Date: Sun, 7 Jun 2026 17:02:14 +0530 Refactor GitHub Actions workflow for file sync Updated GitHub Actions workflow for syncing files to Hugging Face and adjusted steps for safety and clarity. Diffstat:
| M | .github/workflows/main.yml | | | 50 | ++++++++++++++++++++------------------------------ |
1 file changed, 20 insertions(+), 30 deletions(-)
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml @@ -16,56 +16,50 @@ concurrency: cancel-in-progress: false jobs: - # ========================================== - # JOB 1: SYNC RAW FILES TO HUGGING FACE - # ========================================== sync-hf: runs-on: ubuntu-latest steps: - - name: Checkout + - name: Checkout GitHub Repo uses: actions/checkout@v4 with: - fetch-depth: 1 # Full history is not needed for the HF sync + fetch-depth: 1 - - name: Force Sync Clean History to Hugging Face + - name: Safe Sync to Hugging Face env: HF_TOKEN: ${{ secrets.HF_TOKEN }} run: | - # 1. Delete git history to bypass the 10MB limit on old commits - rm -rf .git - - # 2. Sweep for and delete any compiler binaries - find . -name "*.exe" -type f -delete || true + git clone https://notamitgamer:${HF_TOKEN}@huggingface.co/datasets/notamitgamer/usercontent /tmp/hf_repo - # 3. Initialize fresh git tracking - git init - git checkout -b main - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" + rsync -av --delete \ + --exclude='.git' \ + --exclude='MinGW64' \ + --exclude='*.exe' \ + --exclude='site_files' \ + $GITHUB_WORKSPACE/ /tmp/hf_repo/ + + cd /tmp/hf_repo - # 4. Setup Git LFS for PDFs and DOCX files git lfs install git lfs track "*.pdf" git lfs track "*.docx" git add .gitattributes - # 5. Add all files (semester_1 to semester_8 folder paths remain perfectly intact) + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add . - git commit -m "Auto-sync latest raw files to Hugging Face" - # 6. Push to Hugging Face Datasets - git push --force https://notamitgamer:${HF_TOKEN}@huggingface.co/datasets/notamitgamer/usercontent main:main + git commit -m "Safe auto-sync: updating GitHub files while protecting dynamic folders" || echo "No changes to commit" + + git push origin main - # ========================================== - # JOB 2: BUILD VITEPRESS SITE - # ========================================== build: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 with: - fetch-depth: 0 # CRITICAL: Needed for VitePress lastUpdated timestamps + fetch-depth: 0 - name: Setup Python uses: actions/setup-python@v5 @@ -96,9 +90,6 @@ jobs: with: path: docs-new/.vitepress/dist - # ========================================== - # JOB 3: DEPLOY TO GITHUB PAGES - # ========================================== deploy: environment: name: github-pages @@ -108,4 +99,4 @@ jobs: steps: - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v4- \ No newline at end of file + uses: actions/deploy-pages@v4