Skip to content

Commit

Permalink
Create clone-count.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
3022-2 authored Aug 3, 2024
1 parent ffc5a63 commit 0b5c2b9
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/clone-count.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#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 '[email protected]'
git add clone-count-badge.svg
git commit -m "Update clone count badge"
git push

0 comments on commit 0b5c2b9

Please sign in to comment.