feat(profile): embed commit heatmap
This commit is contained in:
@@ -3,6 +3,7 @@ on:
|
||||
push:
|
||||
paths:
|
||||
- 'public/code-stats.json'
|
||||
- 'public/heatmap.json'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
@@ -26,6 +27,11 @@ jobs:
|
||||
elif command -v apt-get &> /dev/null; then apt-get update && apt-get install -y jq; fi
|
||||
fi
|
||||
|
||||
if ! command -v python3 &> /dev/null; then
|
||||
if command -v apk &> /dev/null; then apk add --no-cache python3;
|
||||
elif command -v apt-get &> /dev/null; then apt-get update && apt-get install -y python3; fi
|
||||
fi
|
||||
|
||||
# Use our own heatmap.json instead of Gitea API
|
||||
HEATMAP_FILE="public/heatmap.json"
|
||||
TOTAL_COMMITS=$(jq '[.days[] | .count] | add' "$HEATMAP_FILE")
|
||||
@@ -37,6 +43,8 @@ jobs:
|
||||
FORMATTED_LOC=$(printf "%'d" $LOC)
|
||||
echo "FORMATTED_LOC=$FORMATTED_LOC" >> $GITHUB_ENV
|
||||
|
||||
python3 scripts/generate_heatmap_svg.py public/heatmap.json public/heatmap.svg
|
||||
|
||||
sed "s/REPLACE_ME_LOC/$FORMATTED_LOC/g" README.template | \
|
||||
sed "s/REPLACE_ME_COMMITS/$TOTAL_COMMITS/g" > README.md
|
||||
|
||||
@@ -44,11 +52,11 @@ jobs:
|
||||
run: |
|
||||
git config user.name "Ares-Bot"
|
||||
git config user.email "ares@beane.me"
|
||||
git add README.md
|
||||
git add README.md public/heatmap.svg
|
||||
|
||||
if git diff --staged --quiet; then
|
||||
echo "No changes to commit"
|
||||
else
|
||||
git commit -m "chore: sync code velocity to ${{ env.FORMATTED_LOC }} LOC [skip ci]"
|
||||
git commit -m "chore: sync profile metrics [skip ci]"
|
||||
git push http://patrick:${{ secrets.PAT_TOKEN }}@gitea-http:3000/${{ github.repository }}.git ${{ github.ref_name }}
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user