initial commit: Profile
Some checks failed
Update Code Statistics / sync-stats (push) Failing after 0s
Some checks failed
Update Code Statistics / sync-stats (push) Failing after 0s
This commit is contained in:
35
.gitea/workflows/update-readme.yaml
Normal file
35
.gitea/workflows/update-readme.yaml
Normal file
@@ -0,0 +1,35 @@
|
||||
name: Update Code Statistics
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'public/code-stats.json'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
sync-stats:
|
||||
runs-on: sh
|
||||
steps:
|
||||
- name: Manual Internal Checkout
|
||||
run: |
|
||||
git clone http://gitea-http:3000/${{ github.repository }}.git .
|
||||
git checkout ${{ github.ref_name }}
|
||||
|
||||
- name: Update README
|
||||
run: |
|
||||
LOC=$(grep -o '"total_code":[0-9]*' public/code-stats.json | cut -d: -f2)
|
||||
|
||||
FORMATTED_LOC=$(printf "%'d" $LOC)
|
||||
echo "Detected $FORMATTED_LOC lines of code."
|
||||
|
||||
sed -i "s/\(\).*\(\)/\1$FORMATTED_LOC\2/" README.md
|
||||
|
||||
- name: Commit and Push
|
||||
run: |
|
||||
git config user.name "Ares-Bot"
|
||||
git config user.email "ares@beane.me"
|
||||
git add README.md
|
||||
if git diff --staged --quiet; then
|
||||
echo "No changes"
|
||||
else
|
||||
git commit -m "chore: sync code velocity to $FORMATTED_LOC LOC [skip ci]"
|
||||
git push http://${{ secrets.GITHUB_TOKEN }}@gitea-http:3000/${{ github.repository }}.git ${{ github.ref_name }}
|
||||
Reference in New Issue
Block a user