Update clone#, PyPI download# and Dashboard #435
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update clone#, PyPI download# and Dashboard | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| on: | |
| schedule: | |
| - cron: '17 4 * * *' # Run daily at 04:17 UTC | |
| workflow_dispatch: | |
| jobs: | |
| update-clones: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: pip install requests matplotlib pandas | |
| - name: Run fetch_clones.py # GitHub clone stats | |
| env: | |
| TOKEN: ${{ secrets.DAR_BACKUP_METRICS }} | |
| run: PYTHONPATH=src python src/clonepulse/fetch_clones.py --user per2jensen --repo dar-backup | |
| - name: Run download tracker | |
| run: python v2/scripts/track_downloads.py # get PyPI download stats for `dar-backup` | |
| - name: Generate dashboard image | |
| run: PYTHONPATH=src python src/clonepulse/generate_clone_dashboard.py --user per2jensen --repo dar-backup | |
| - name: Show Git status (debug) | |
| run: | | |
| echo "::group::Git Status" | |
| git status | |
| echo "::endgroup::" | |
| echo "::group::Git Diff" | |
| git diff | |
| echo "::endgroup::" | |
| echo "::group::Untracked Files" | |
| git ls-files --others --exclude-standard | |
| echo "::endgroup::" | |
| - name: Commit changes | |
| run: | | |
| git config --global user.name "github-actions" | |
| git config --global user.email "actions@github.com" | |
| # Check for changes before committing | |
| if ! git diff --quiet || [ -n "$(git ls-files --others --exclude-standard)" ]; then | |
| echo "Changes detected, committing..." | |
| git add $(find clonepulse -type f \( -name '*.json' -o -name '*.png' -o -name 'milestone_*.txt' \)) || true | |
| git commit -m "clone#, PyPI download#, update dashboard on $(date -u '+%Y-%m-%dT%H:%M:%SZ')" | |
| # Push changes — if it fails, likely due to race; next run will retry | |
| git push || echo "⚠️ Push failed (likely a fast-forward conflict). Will retry next time." | |
| else | |
| echo "No changes to commit." | |
| fi |