commit a20f0ba86a8e3a6864d6a76c3fde217c5891e6a5
parent 01946db49ed600c5659cdad969ce15df84aa53c4
Author: Amit Dutta <mail@amit.is-a.dev>
Date: Mon, 24 Aug 2026 19:45:30 +0530
Merge pull request #79 from notamitgamer/notamitgamer-patch-1
Remove VitePress cache step from workflow
Diffstat:
2 files changed, 16 insertions(+), 23 deletions(-)
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
@@ -18,6 +18,7 @@ concurrency:
cancel-in-progress: false
jobs:
+ # Job 1: Independent cloud synchronization
sync-hf:
runs-on: ubuntu-latest
if: github.actor != 'bot-for-notamitgamer[bot]'
@@ -32,31 +33,25 @@ jobs:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
git clone https://notamitgamer:${HF_TOKEN}@huggingface.co/datasets/notamitgamer/usercontent /tmp/hf_repo
-
rsync -av --delete \
--exclude='.git' \
--exclude='MinGW64' \
--exclude='*.exe' \
--exclude='site_files' \
$GITHUB_WORKSPACE/ /tmp/hf_repo/
-
cd /tmp/hf_repo
-
git lfs install
git lfs track "*.pdf"
git lfs track "*.docx"
git lfs track "*.odt"
git add .gitattributes
-
git config user.name "bot-for-notamitgamer[bot]"
git config user.email "bot-for-notamitgamer[bot]@users.noreply.github.com"
-
git add .
-
git commit -m "Safe auto-sync: updating GitHub files while protecting dynamic folders" || echo "No changes to commit"
-
git push origin main
+ # Job 2: Main processing engine (Generates data -> Commits -> Builds)
build:
runs-on: ubuntu-latest
if: github.actor != 'bot-for-notamitgamer[bot]'
@@ -99,10 +94,10 @@ jobs:
run: |
git config user.name "bot-for-notamitgamer[bot]"
git config user.email "bot-for-notamitgamer[bot]@users.noreply.github.com"
-
git add CHANGELOG.md
-
if ! git diff --cached --quiet; then
+ # Pushing with [skip ci] handles generic actions, but our job-level filter
+ # github.actor != 'bot-for-notamitgamer[bot]' is the true shield stopping the infinite loop.
git commit -m "chore: update changelog [skip ci]"
git push
else
@@ -122,7 +117,7 @@ jobs:
uses: actions/cache@v4
with:
path: docs/.vitepress/cache
- key: ${{ runner.os }}-vitepress-${{ hashFiles('**/*.md', 'package-lock.json') }}
+ key: ${{ runner.os }}-vitepress-${{ hashFiles('package-lock.json', 'docs/.vitepress/config.*') }}
restore-keys: |
${{ runner.os }}-vitepress-
@@ -136,6 +131,7 @@ jobs:
with:
path: docs/.vitepress/dist
+ # Job 3: Standard automated fallback backup
release:
runs-on: ubuntu-latest
needs: build
@@ -169,11 +165,11 @@ jobs:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
gh release delete latest-backup -y --cleanup-tag || true
-
gh release create "latest-backup" "full-repo-backup-${{ env.TIMESTAMP }}.bundle" \
--title "Latest Bundle Backup - ${{ env.PRETTY_DATE }}" \
--notes "Automated full repository bundle generated on ${{ env.PRETTY_DATE }}. Restore offline using \`git clone full-repo-backup-${{ env.TIMESTAMP }}.bundle\`."
+ # Job 4: Clean deployment production pipeline
deploy:
environment:
name: github-pages
diff --git a/utils/bsc_md/formatting.py b/utils/bsc_md/formatting.py
@@ -1,50 +1,48 @@
import os
import re
-
def esc_yaml(s: str) -> str:
return s.replace("'", "''")
-
def slugify_tag(s: str) -> str:
- """Turn a folder/lang name into a clean tag slug."""
+ """Turn a folder name into a clean tag slug."""
s = s.strip().lower()
s = re.sub(r'[_\s]+', '-', s)
s = re.sub(r'[^a-z0-9\-]', '', s)
return re.sub(r'-+', '-', s).strip('-')
-
def derive_tags(rel_path: str, lang_label: str = "") -> list:
"""Derive tag slugs from a file path relative to BSC_ROOT."""
parts = [p for p in os.path.normpath(rel_path).split(os.sep) if p]
tags = []
+ # 1. Generate tags from folder names
for part in parts[:-1]:
m = re.match(r'^semester[_-]?(\d+)$', part, re.IGNORECASE)
tag = f"sem{m.group(1)}" if m else slugify_tag(part)
if tag and tag not in tags:
tags.append(tag)
- if lang_label:
- lang_tag = slugify_tag(lang_label)
- if lang_tag and lang_tag not in tags:
- tags.append(lang_tag)
+ # 2. Dynamically generate the language tag from the exact file extension
+ _, ext = os.path.splitext(rel_path)
+ if ext:
+ # Removes the '.' and converts to uppercase (e.g., '.cpp' -> 'CPP')
+ ext_tag = ext.lstrip('.').upper()
+ if ext_tag and ext_tag not in tags:
+ tags.append(ext_tag)
return tags
-
def format_tags_yaml(tags: list) -> str:
if not tags:
return "tags: []"
items = ", ".join(f"'{esc_yaml(t)}'" for t in tags)
return f"tags: [{items}]"
-
def esc_html(s: str) -> str:
"""Escape characters that break Vue template compilation in VitePress."""
return s.replace('&', '&').replace('<', '<').replace('>', '>')
-
def format_author(author: str) -> str:
"""Return a mailto markdown link if the author string contains an email.
Handles both 'Name <email>' and 'Name (email)' formats."""
@@ -55,7 +53,6 @@ def format_author(author: str) -> str:
return f"[{name}](mailto:{email})"
return esc_html(author)
-
def format_author_html(author: str) -> str:
"""Return an HTML <a> mailto link if the author string contains an email.
Handles both 'Name <email>' and 'Name (email)' formats."""