GitHub Repo View Tracker #25
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: 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 | |