Skip to content

ARE WE FUCKING SERIOUS IS THIS ACTUALLY THE PROBLEM #4

ARE WE FUCKING SERIOUS IS THIS ACTUALLY THE PROBLEM

ARE WE FUCKING SERIOUS IS THIS ACTUALLY THE PROBLEM #4

Workflow file for this run

name: LOC Badge
on:
push:
branches: [main]
jobs:
count-loc:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install cloc
run: |
sudo apt-get update
sudo apt-get install -y cloc
- name: Count lines with cloc
run: |
cloc . --csv --out=loc.csv
- name: Generate badge
run: |
CODE=$(tail -n 1 loc.csv | cut -d ',' -f5)
echo "![LOC](https://img.shields.io/badge/lines-$CODE-blue)" > loc-badge.md
- name: Push to badges branch
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
git config --global user.name "github-actions"
git config --global user.email "actions@github.com"
git checkout -B badges
git add loc.csv loc-badge.md
git remote set-url origin https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}
git commit -m "Update LOC badge" || echo "No changes to commit"
git push --force https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }} badges