Skip to content

Commit 05fdfd9

Browse files
committed
upload to huggingface only (hopefully)
1 parent dcb01d2 commit 05fdfd9

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

.github/workflows/daily-scrape.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
- name: Update Statistics
4040
run: python compare_last_two.py --json
4141

42-
# Step 6: Commit and Push both the CSVs and the JSON
42+
# Step 6: Commit and Push tag_stats.json (always needed for GitHub Pages)
4343
- name: Commit and Push
4444
run: |
4545
git config user.name "github-actions[bot]"
@@ -48,8 +48,14 @@ jobs:
4848
# Configure the remote with the token for authentication
4949
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
5050
51-
# Add the tags directory (scraped data), tags.csv, and the new JSON file
52-
git add tags/ tags.csv tag_stats.json
51+
# Always add tag_stats.json (needed for the live dashboard)
52+
git add tag_stats.json
53+
54+
# Only commit tags/ and tags.csv if HuggingFace upload failed
55+
if [ -f .hf_upload_status ] && grep -q "failed" .hf_upload_status; then
56+
echo "HF upload failed - committing local data as backup"
57+
git add tags/ tags.csv
58+
fi
5359
5460
# Commit only if there are actual changes
5561
git diff --quiet && git diff --staged --quiet || git commit -m "Daily update: scrape and stats"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.hf_upload_status

scrape_tags.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,4 +212,8 @@ def sort_by_latest_count(tag_name):
212212
print("Scraping complete.")
213213

214214
merge_into_tags_csv(csv_filename, filename_date)
215-
upload_to_huggingface(csv_filename, filename_date)
215+
hf_success = upload_to_huggingface(csv_filename, filename_date)
216+
217+
status_file = ".hf_upload_status"
218+
with open(status_file, "w") as f:
219+
f.write("success" if hf_success else "failed")

0 commit comments

Comments
 (0)