repo-stats.yml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. name: GitHub Repo Stats
  2. on:
  3. schedule:
  4. - cron: "0 23 * * *"
  5. workflow_dispatch:
  6. permissions:
  7. contents: write
  8. jobs:
  9. repo-stats:
  10. name: repo-stats
  11. runs-on: ubuntu-latest
  12. steps:
  13. - name: run-ghrs
  14. uses: jgehrcke/github-repo-stats@v1.4.2
  15. with:
  16. repository: maziggy/bambuddy
  17. ghtoken: ${{ secrets.GHRS_GITHUB_API_TOKEN }}
  18. ghpagesprefix: https://maziggy.github.io/bambuddy
  19. # Inject ghcr.io container-download stats (cumulative + 30-day
  20. # sparkline merged into a sidecar CSV so the chart grows beyond
  21. # the 30-day window GHCR exposes). Runs after jgehrcke regenerates
  22. # report.html on gh-pages.
  23. - name: checkout-source
  24. uses: actions/checkout@v4
  25. with:
  26. path: source
  27. - name: checkout-gh-pages
  28. uses: actions/checkout@v4
  29. with:
  30. ref: gh-pages
  31. path: gh-pages
  32. - name: inject-ghcr-pulls
  33. run: |
  34. python3 source/.github/scripts/ghcr_inject.py \
  35. --report gh-pages/maziggy/bambuddy/latest-report/report.html \
  36. --csv gh-pages/maziggy/bambuddy/ghcr-pulls.csv \
  37. --owner maziggy \
  38. --pkg bambuddy
  39. - name: commit-and-push
  40. working-directory: gh-pages
  41. run: |
  42. if [ -z "$(git status --porcelain)" ]; then
  43. echo "no changes — skipping commit"
  44. exit 0
  45. fi
  46. git config user.name "github-actions[bot]"
  47. git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
  48. git add maziggy/bambuddy/latest-report/report.html \
  49. maziggy/bambuddy/ghcr-pulls.csv
  50. git commit -m "ghcr-pulls: refresh container downloads chart"
  51. git push