fix: GitHub Actions workflow update
This commit is contained in:
@@ -16,10 +16,16 @@ jobs:
|
||||
|
||||
- name: Update README
|
||||
run: |
|
||||
LOC=$(grep -o '"total_code":[0-9]*' public/code-stats.json | cut -d: -f2)
|
||||
LOC=$(grep '"total_code"' public/code-stats.json | sed 's/[^0-9]*//g')
|
||||
|
||||
if [ -z "$LOC" ] || [ "$LOC" -eq 0 ]; then
|
||||
echo "Error: Could not parse LOC or LOC is 0. Checking file existence..."
|
||||
ls -R public/
|
||||
exit 1
|
||||
fi
|
||||
|
||||
FORMATTED_LOC=$(printf "%'d" $LOC)
|
||||
echo "Detected $FORMATTED_LOC lines of code."
|
||||
echo "Detected $FORMATTED_LOC lines of code. Updating README..."
|
||||
|
||||
sed -i "s/\(\).*\(\)/\1$FORMATTED_LOC\2/" README.md
|
||||
|
||||
@@ -28,8 +34,10 @@ jobs:
|
||||
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 }}
|
||||
git push http://${{ secrets.GITHUB_TOKEN }}@gitea-http:3000/${{ github.repository }}.git main
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user