File tree Expand file tree Collapse file tree 3 files changed +15
-4
lines changed
Expand file tree Collapse file tree 3 files changed +15
-4
lines changed Original file line number Diff line number Diff line change 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]"
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"
Original file line number Diff line number Diff line change 1+ .hf_upload_status
Original file line number Diff line number Diff line change @@ -212,4 +212,8 @@ def sort_by_latest_count(tag_name):
212212print ("Scraping complete." )
213213
214214merge_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" )
You can’t perform that action at this time.
0 commit comments