Skip to content

Create clone-count.yml #1

Create clone-count.yml

Create clone-count.yml #1

Workflow file for this run

#used chatgpt for this lol
name: Clone Count
on:
schedule:
- cron: '0 0 * * *'
push:
branches:
- main
jobs:
update-clone-count:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Fetch clone count
run: |
CLONE_COUNT=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/traffic/clones \
| jq '.count')
echo "clone_count=${CLONE_COUNT}" >> $GITHUB_ENV
- name: Update badge
run: |
curl -o clone-count-badge.svg "https://img.shields.io/badge/Clones-${{ env.clone_count }}-brightgreen"
git config --global user.name 'github-actions'
git config --global user.email 'github-actions@github.com'
git add clone-count-badge.svg
git commit -m "Update clone count badge"
git push