ARE WE FUCKING SERIOUS IS THIS ACTUALLY THE PROBLEM #4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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-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 |