File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed
Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Generate LoC Badge
2+
3+ permissions :
4+ contents : write
5+
6+ on :
7+ push :
8+ branches : [ main ]
9+ workflow_dispatch : {}
10+
11+ jobs :
12+ generate :
13+ name : Generate Lines-of-Code Badge
14+ runs-on : ubuntu-latest
15+ steps :
16+ - name : Checkout
17+ uses : actions/checkout@v4
18+ with :
19+ token : ${{ secrets.GITHUB_TOKEN }}
20+ fetch-depth : 0
21+ persist-credentials : true
22+
23+ - name : Make Code Badge
24+ uses :
shadowmoose/[email protected] 25+ id : badge
26+ with :
27+ debug : true
28+ directory : ./
29+ badge : ./output/badge.svg
30+ patterns : " **/*.py|**/*.sh|Makefile"
31+ ignore : " .venv|venv|env|node_modules|.git"
32+
33+ - name : Push badge to image-data branch
34+ env :
35+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
36+ run : |
37+ set -euo pipefail
38+ # Prepare a minimal repo containing only the badge and push it to image-data
39+ mkdir -p badge-tmp
40+ cp output/badge.svg badge-tmp/badge.svg
41+ cd badge-tmp
42+ # Initialize with main as default branch and set local identity
43+ git init -b main
44+ git config user.name "github-actions[bot]"
45+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
46+ # Ensure commit has explicit author/committer env vars to avoid empty ident
47+ GIT_AUTHOR_NAME="github-actions[bot]" GIT_AUTHOR_EMAIL="41898282+github-actions[bot]@users.noreply.github.com" GIT_COMMITTER_NAME="github-actions[bot]" GIT_COMMITTER_EMAIL="41898282+github-actions[bot]@users.noreply.github.com" git add badge.svg && \
48+ GIT_AUTHOR_NAME="github-actions[bot]" GIT_AUTHOR_EMAIL="41898282+github-actions[bot]@users.noreply.github.com" GIT_COMMITTER_NAME="github-actions[bot]" GIT_COMMITTER_EMAIL="41898282+github-actions[bot]@users.noreply.github.com" git commit -m "chore: update LoC badge"
49+ git remote add origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git"
50+ git push --force origin HEAD:image-data
You can’t perform that action at this time.
0 commit comments