Track Repository Usage #14
This file contains 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: Track Repository Usage | |
on: | |
schedule: | |
- cron: "0 0 * * *" # Runs daily at midnight UTC | |
workflow_dispatch: # Allows manual triggering of the workflow | |
jobs: | |
track_usage: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Fetch repository traffic views | |
run: | | |
curl -H "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \ | |
https://api.github.com/repos/PennSIVE/ComBatFamQC/traffic/views > views.json | |
- name: Fetch repository traffic clones | |
run: | | |
curl -H "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \ | |
https://api.github.com/repos/PennSIVE/ComBatFamQC/traffic/clones > clones.json | |
- name: Commit and push data | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git add views.json clones.json | |
git commit -m "Update traffic data [skip ci]" | |
git push |