-
-
Notifications
You must be signed in to change notification settings - Fork 46
36 lines (31 loc) · 1.22 KB
/
lines-of-code.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
name: Update LOC metrics (lines of code)
on:
push:
branches: ["main"]
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Download scc
run: |
mkdir scc
cd scc
gh release download v3.1.0 -R boyter/scc -p '*Linux_x86_64.tar.gz' -O scc.tar.gz
tar -xf scc.tar.gz
chmod +x scc
pwd >> $GITHUB_PATH
env:
GH_TOKEN: ${{ github.token }}
- name: Run update script
run: |
cargo metadata --offline --format-version 1 --no-deps | jq -r ".workspace_members[]" | while read -r name version pathInfo ; do
linesOfRustCode=$(scc -c --no-cocomo -f json -i rs ${pathInfo:13:-1} | jq '.[] | .Code');
curl \
--header "Content-Type: application/json" \
--header "X-POST-ACCESS-KEY: ${{ secrets.PROJECTS_POST_ACCESS_KEY }}" \
--data "{\"project\":\"$name\",\"language\":\"rust\",\"loc\":$linesOfRustCode}" \
-w "\nUpdated-project: \n" \
https://projects.kaleidawave.workers.dev/update-project;
echo "\`$name\` has $linesOfRustCode lines of code" >> $GITHUB_STEP_SUMMARY;
done