Skip to content

Commit a2d193d

Browse files
authored
Update update-readme.yml
1 parent 97bba20 commit a2d193d

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

.github/workflows/update-readme.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,21 @@ jobs:
1818
run: |
1919
PY_FILES=$(find . -name "*.py" | wc -l)
2020
TOTAL_LINES=$(find . -name "*.py" -exec cat {} + | wc -l)
21-
echo "📄 Total lines of code: $TOTAL_LINES" > stats.txt
22-
echo "🐍 Number of Python files: $PY_FILES" >> stats.txt
23-
echo "🕒 Last updated: $(date -u +"%Y-%m-%d %H:%M UTC")" >> stats.txt
24-
cat stats.txt > README.md
21+
echo "PY_FILES=$PY_FILES" >> $GITHUB_ENV
22+
echo "TOTAL_LINES=$TOTAL_LINES" >> $GITHUB_ENV
23+
24+
- name: Update README.md
25+
run: |
26+
STATS="📄 Total lines of code: $TOTAL_LINES\n🐍 Number of Python files: $PY_FILES"
27+
DATE="🕒 Last updated: $(date -u +"%Y-%m-%d %H:%M UTC")"
28+
29+
sed -i "/<!-- STATS:START -->/,/<!-- STATS:END -->/c\\<!-- STATS:START -->\n$STATS\n<!-- STATS:END -->" README.md
30+
sed -i "/<!-- UPDATED:START -->/,/<!-- UPDATED:END -->/c\\<!-- UPDATED:START -->\n$DATE\n<!-- UPDATED:END -->" README.md
2531
2632
- name: Commit changes
2733
run: |
2834
git config --global user.name "GitHub Actions Bot"
2935
git config --global user.email "[email protected]"
3036
git add README.md
31-
TIMESTAMP=$(date -u +"%Y-%m-%d %H:%M UTC")
32-
git commit --allow-empty -m "🧠 Update README stats [$TIMESTAMP]"
37+
git commit -m "🧠 Update README stats"
3338
git push

0 commit comments

Comments
 (0)