Skip to content

GitHub Repo View Tracker #18

GitHub Repo View Tracker

GitHub Repo View Tracker #18

name: GitHub Repo View Tracker
on:
schedule:
- cron: '0 0 */2 * *' # Every 2 days
workflow_dispatch:
jobs:
update-views:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install Dependencies
run: pip install PyGithub
- name: Run the Tracker Script
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: python repo_view_tracker.py
- name: Commit and Push Updated View Counts
if: success()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name "Pritz69"
git config --global user.email "your-email@example.com"
git add repo_views.json
git commit -m "Update repo view counts (Automated)" || echo "No changes to commit"
git remote set-url origin https://github-actions[bot]:${{ secrets.GITHUB_TOKEN }}@github.com/Pritz69/GitHub-Repo-View-Tracker.git
git push origin main