Skip to content

ci: generate badge with unique cloners #9

ci: generate badge with unique cloners

ci: generate badge with unique cloners #9

Workflow file for this run

name: Badges
on:
push:
branches:
- main
jobs:
git-estimate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: '1.22.1'
cache: false
- name: Estimate time spent
run: |
git clone https://github.com/luigitni/git-estimate.git /tmp/git-estimate
cd /tmp/git-estimate
go build git-estimate
go install
cd -
sudo apt install jq jo
HOURS=$(git-estimate -json | jq '.overall.hours | round')
jo -p \
"schemaVersion=1" \
"label=⏳ Time spent" \
"message=$HOURS hours" \
"color=blue" \
"style=for-the-badge" > fish-ai-badge-git-estimate.json
- name: Store result
uses: realiserad/actions-deploy-gist@main
with:
token: ${{ secrets.TOKEN }}
gist_id: e6c5166b6c0e77febe5cbd719c6c236a
file_path: fish-ai-badge-git-estimate.json
unique-cloners:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: |
sudo apt install jq jo
gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/Realiserad/fish-ai/traffic/clones > clones.json
UNIQUE_CLONERS=$(jq '.uniques' clones.json)
jo -p \
"schemaVersion=1" \
"label=🍾 Popularity" \
"message=$UNIQUE_CLONERS users" \
"color=blue" \
"style=for-the-badge" > fish-ai-badge-unique-cloners.json
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Store result
uses: exuanbo/actions-deploy-gist@v1
with:
token: ${{ secrets.TOKEN }}
gist_id: e6c5166b6c0e77febe5cbd719c6c236a
file_path: fish-ai-badge-unique-cloners.json