Skip to content

Commit e469924

Browse files
committed
feat: add CLOC to generated readme
1 parent a73e754 commit e469924

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

.github/workflows/gen-readme.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Generate README
2+
on:
3+
push:
4+
pull_request:
5+
paths:
6+
- "README.md" # This isn't needed, but it's a good sanity check
7+
- "README.tmpl.md"
8+
workflow_dispatch:
9+
jobs:
10+
generate-readme:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
steps:
15+
- uses: actions/checkout@master
16+
- run: |
17+
[ -f README.tmpl.md ] || cp README.md README.tmpl.md # Initialize README.tmpl.md
18+
printf '%s\n' "<!-- This file is generated from README.tmpl.md -->" > README.md
19+
cat README.tmpl.md >> README.md
20+
- name: CLOC
21+
uses: djdefi/cloc-action@6
22+
with:
23+
options: --md --report-file=cloc.md --hide-rate
24+
# Note: initial newline is required because files don't end with one
25+
- run: |
26+
printf '\n%s\n' '### Lines of code' >> README.md
27+
cat cloc.md >> README.md
28+
rm cloc.md
29+
- uses: stefanzweifel/git-auto-commit-action@v4
30+
with:
31+
commit_message: "chore: Generate README"
32+
# Note: README.tmpl.md is needed in the first case
33+
file_pattern: README.md README.tmpl.md

0 commit comments

Comments
 (0)