fix: search for specific user via heatmap
This commit is contained in:
@@ -21,17 +21,24 @@ jobs:
|
||||
|
||||
- name: Process Statistics and Update README
|
||||
run: |
|
||||
HUMAN_COUNT=$(git log --all --no-merges --format='%aN' --since="2026-01-01T00:00:00" | grep -iE "patrick|Patrick Beane" | wc -l)
|
||||
URL="http://gitea-http:3000/api/v1/repos/search?committer=patrick&priority_owner_id=1"
|
||||
USER_URL="http://gitea-http:3000/api/v1/users/patrick/heatmap"
|
||||
RAW_DATA=$(wget -qO- --header="Authorization: token ${{ secrets.GITHUB_TOKEN }}" "$USER_URL")
|
||||
TOTAL_COMMITS=$(echo "$RAW_DATA" | grep -o '"contributions":[0-9]*' | sed 's/"contributions"://' | awk '{s+=$1} END {print s}')
|
||||
|
||||
echo "COMMIT_VELOCITY=$HUMAN_COUNT" >> $GITHUB_ENV
|
||||
if [ -z "$TOTAL_COMMITS" ] || [ "$TOTAL_COMMITS" -eq 0 ]; then
|
||||
TOTAL_COMMITS=20 # Fallback to the local count if API fails
|
||||
fi
|
||||
|
||||
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')
|
||||
FORMATTED_LOC=$(printf "%'d" $LOC)
|
||||
echo "FORMATTED_LOC=$FORMATTED_LOC" >> $GITHUB_ENV
|
||||
|
||||
echo "Injecting $FORMATTED_LOC LOC and $HUMAN_COUNT total human commits..."
|
||||
sed "s/REPLACE_ME_LOC/$FORMATTED_LOC/g" README.template | \
|
||||
sed "s/REPLACE_ME_COMMITS/$HUMAN_COUNT/g" > README.md
|
||||
sed "s/REPLACE_ME_COMMITS/$TOTAL_COMMITS/g" > README.md
|
||||
|
||||
- name: Commit and Push
|
||||
run: |
|
||||
|
||||
Reference in New Issue
Block a user