Skip to content

Commit b68e908

Browse files
lines of code badge?
1 parent 505fae1 commit b68e908

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

.github/workflows/loc-badge.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: LOC Badge
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
count-loc:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v3
13+
14+
- name: Install cloc
15+
run: |
16+
sudo apt-get update
17+
sudo apt-get install -y cloc
18+
19+
- name: Count lines with cloc
20+
run: |
21+
cloc . --csv --out=loc.csv
22+
23+
- name: Generate badge
24+
run: |
25+
CODE=$(tail -n 1 loc.csv | cut -d ',' -f5)
26+
echo "![LOC](https://img.shields.io/badge/lines-$CODE-blue)" > loc-badge.md
27+
28+
- name: Commit badge
29+
run: |
30+
git config --global user.name "github-actions"
31+
git config --global user.email "[email protected]"
32+
git add loc.csv loc-badge.md
33+
git commit -m "Update LOC badge" || echo "No changes to commit"
34+
git push

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
![License](https://img.shields.io/github/license/hellonearth311/statz)
55
![GitHub issues](https://img.shields.io/github/issues/hellonearth311/statz)
66
![Last Commit](https://img.shields.io/endpoint?url=https://github-last-commit-badge.vercel.app/lastcommit)
7+
[![LOC](https://raw.githubusercontent.com/YOUR_USERNAME/YOUR_REPO/main/loc-badge.md)](loc.csv)
78

89
**statz** is a cross-platform Python package that fetches **real-time system usage** and **hardware specs** — all wrapped in a simple, clean API.
910

0 commit comments

Comments
 (0)