From d7427907fbd7c986826a07ce0abfcd00b643dc2b Mon Sep 17 00:00:00 2001 From: Pavel Date: Fri, 27 Feb 2026 20:12:13 +0300 Subject: [PATCH 1/2] Fix tloc workflow with custom cloc script #33 --- .github/workflows/tloc.yaml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tloc.yaml b/.github/workflows/tloc.yaml index 0da1944..035d025 100644 --- a/.github/workflows/tloc.yaml +++ b/.github/workflows/tloc.yaml @@ -12,6 +12,19 @@ jobs: permissions: contents: write steps: - - uses: actions/checkout@v2 - - name: Code Lines Badge - uses: Kherrisan/cloc-badge-action@1.0.1 + - uses: actions/checkout@v4 + - name: Count Lines of Code + run: | + sudo apt-get update -qq && sudo apt-get install -y cloc + cloc . --quiet --json --out=cloc.json + LOC=$(cat cloc.json | python3 -c "import json,sys; d=json.load(sys.stdin); print(sum(d[k]['code'] for k in d if k!='header'))") + echo "LOC=$LOC" >> $GITHUB_ENV + - name: Create badge + run: | + pip install shields-badge + shields-badge --label "LOC" --value "${{ env.LOC }}" --format svg --output cloc.svg + - name: Commit badge + uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: "Update LOC badge" + file_pattern: cloc.svg From 8152aad1d8a439197d6a73ceff6030c6567b1ca4 Mon Sep 17 00:00:00 2001 From: Pavel Date: Fri, 27 Feb 2026 20:17:49 +0300 Subject: [PATCH 2/2] Fix tloc workflow - simple SVG badge #33 --- .github/workflows/tloc.yaml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tloc.yaml b/.github/workflows/tloc.yaml index 035d025..098d775 100644 --- a/.github/workflows/tloc.yaml +++ b/.github/workflows/tloc.yaml @@ -19,10 +19,16 @@ jobs: cloc . --quiet --json --out=cloc.json LOC=$(cat cloc.json | python3 -c "import json,sys; d=json.load(sys.stdin); print(sum(d[k]['code'] for k in d if k!='header'))") echo "LOC=$LOC" >> $GITHUB_ENV + echo "LOC" > label.txt + echo "$LOC" > value.txt - name: Create badge run: | - pip install shields-badge - shields-badge --label "LOC" --value "${{ env.LOC }}" --format svg --output cloc.svg + LABEL=$(cat label.txt) + VALUE=$(cat value.txt) + cat > cloc.svg << 'EOF' + LOC: VALUELABELLABELVALUEVALUE + EOF + sed -i "s/LABEL/$LABEL/g; s/VALUE/$VALUE/g" cloc.svg - name: Commit badge uses: stefanzweifel/git-auto-commit-action@v5 with: