feat: implement automated code velocity and LOC tracking
This commit is contained in:
@@ -11,7 +11,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Manual Internal Checkout
|
- name: Manual Internal Checkout
|
||||||
run: |
|
run: |
|
||||||
git clone http://gitea-http:3000/${{ github.repository }}.git .
|
git clone --filter=blob:none http://gitea-http:3000/${{ github.repository }}.git .
|
||||||
git checkout ${{ github.ref_name }}
|
git checkout ${{ github.ref_name }}
|
||||||
|
|
||||||
- name: Sync with upstream
|
- name: Sync with upstream
|
||||||
@@ -19,31 +19,37 @@ jobs:
|
|||||||
git fetch origin
|
git fetch origin
|
||||||
git rebase origin/${{ github.ref_name }}
|
git rebase origin/${{ github.ref_name }}
|
||||||
|
|
||||||
- name: Update README
|
- name: Process Statistics and Update README
|
||||||
env:
|
|
||||||
LANG: en_US.UTF-8
|
|
||||||
LC_ALL: en_US.UTF-8
|
|
||||||
run: |
|
run: |
|
||||||
|
if ! command -v jq &> /dev/null; then
|
||||||
|
if command -v apk &> /dev/null; then apk add --no-cache jq;
|
||||||
|
elif command -v apt-get &> /dev/null; then apt-get update && apt-get install -y jq; fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
USER_URL="http://gitea-http:3000/api/v1/users/patrick/heatmap?limit=1000"
|
||||||
|
|
||||||
|
RAW_DATA=$(wget -qO- --header="Authorization: token ${{ secrets.PAT_TOKEN }}" "$USER_URL")
|
||||||
|
TOTAL_COMMITS=$(echo "$RAW_DATA" | jq '. | map(.contributions) | add')
|
||||||
|
|
||||||
|
echo "Global Commit Velocity: $TOTAL_COMMITS"
|
||||||
|
echo "COMMIT_VELOCITY=$TOTAL_COMMITS" >> $GITHUB_ENV
|
||||||
|
|
||||||
LOC=$(grep '"total_code"' public/code-stats.json | sed 's/[^0-9]*//g')
|
LOC=$(grep '"total_code"' public/code-stats.json | sed 's/[^0-9]*//g')
|
||||||
FORMATTED_LOC=$(printf "%'d" $LOC)
|
FORMATTED_LOC=$(printf "%'d" $LOC)
|
||||||
|
echo "FORMATTED_LOC=$FORMATTED_LOC" >> $GITHUB_ENV
|
||||||
|
|
||||||
echo "Injecting $FORMATTED_LOC into README.template..."
|
sed "s/REPLACE_ME_LOC/$FORMATTED_LOC/g" README.template | \
|
||||||
|
sed "s/REPLACE_ME_COMMITS/$TOTAL_COMMITS/g" > README.md
|
||||||
sed "s/REPLACE_ME_LOC/$FORMATTED_LOC/g" README.template > README.md
|
|
||||||
|
|
||||||
if [ ! -s README.md ]; then
|
|
||||||
echo "Error: README.md is empty!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Commit and Push
|
- name: Commit and Push
|
||||||
run: |
|
run: |
|
||||||
git config user.name "Ares-Bot"
|
git config user.name "Ares-Bot"
|
||||||
git config user.email "ares@beane.me"
|
git config user.email "ares@beane.me"
|
||||||
git add README.md
|
git add README.md
|
||||||
|
|
||||||
if git diff --staged --quiet; then
|
if git diff --staged --quiet; then
|
||||||
echo "No changes"
|
echo "No changes to commit"
|
||||||
else
|
else
|
||||||
git commit -m "chore: sync code velocity to $FORMATTED_LOC LOC [skip ci]"
|
git commit -m "chore: sync code velocity to ${{ env.FORMATTED_LOC }} LOC [skip ci]"
|
||||||
git push http://${{ secrets.GITHUB_TOKEN }}@gitea-http:3000/${{ github.repository }}.git ${{ github.ref_name }}
|
git push http://patrick:${{ secrets.PAT_TOKEN }}@gitea-http:3000/${{ github.repository }}.git ${{ github.ref_name }}
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ Actively used across this environment or in adjacent projects:
|
|||||||
## ⚡ Efficiency Metrics
|
## ⚡ Efficiency Metrics
|
||||||
|
|
||||||
- **Codebase Growth:** `9856` lines of custom code across all our repositories
|
- **Codebase Growth:** `9856` lines of custom code across all our repositories
|
||||||
|
- **Commit Velocity:** `245` commits since Jan 1
|
||||||
- **Ares:** Ryzen 9 9950X sustaining ~0.06 load avg while running Gitea and a Kubernetes control plane
|
- **Ares:** Ryzen 9 9950X sustaining ~0.06 load avg while running Gitea and a Kubernetes control plane
|
||||||
- **Resilience:** Automated failover between AWS and peer nodes
|
- **Resilience:** Automated failover between AWS and peer nodes
|
||||||
|
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ Actively used across this environment or in adjacent projects:
|
|||||||
## ⚡ Efficiency Metrics
|
## ⚡ Efficiency Metrics
|
||||||
|
|
||||||
- **Codebase Growth:** `REPLACE_ME_LOC` lines of custom code across all our repositories
|
- **Codebase Growth:** `REPLACE_ME_LOC` lines of custom code across all our repositories
|
||||||
|
- **Commit Velocity:** `REPLACE_ME_COMMITS` commits since Jan 1
|
||||||
- **Ares:** Ryzen 9 9950X sustaining ~0.06 load avg while running Gitea and a Kubernetes control plane
|
- **Ares:** Ryzen 9 9950X sustaining ~0.06 load avg while running Gitea and a Kubernetes control plane
|
||||||
- **Resilience:** Automated failover between AWS and peer nodes
|
- **Resilience:** Automated failover between AWS and peer nodes
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user