@@ -18,30 +18,31 @@ jobs:
1818 with :
1919 token : ${{ secrets.GITHUB_TOKEN }}
2020
21- - name : Fetch contributors and update Hall of Fame & README
21+ - name : Update Contributors in HALL_OF_FAME.md and README.md
2222 run : |
23- # Fetch all contributors (excluding bots)
2423 CONTRIBUTORS=$(curl -s "https://api.github.com/repos/admirerr/DSA-Collection/contributors?per_page=100" \
2524 | jq -r '.[] | select(.type != "Bot") | [.login, .avatar_url, .html_url, .contributions] | @tsv' \
2625 | sort -k4,4nr)
2726
28- # --- Build HTML blocks for Hall of Fame ---
29- TABLE=$(echo "$CONTRIBUTORS" | awk -F'\t' '{printf "<a href =\"%s\" style=\"text-decoration:none; margin:10px;\" ><img src=\"%s\" width=\"80 \" height=\"80\" style=\"border-radius:50%%;\" ><br>%s</a> \n", $3 , $2 , $1 }')
27+ # Build Hall of Fame table with small avatars and handle below
28+ TABLE=$(echo "$CONTRIBUTORS" | awk -F'\t' '{printf "| <div align =\"center\" ><img src=\"%s\" width=\"50 \" height=\"50\"/ ><br>[%s](%s)</div> | %s | \n", $2 , $1 , $3, $4 }')
3029
31- # --- Build avatars row for README ---
32- AVATARS="<div align=\"center\"> $(echo "$CONTRIBUTORS" | awk -F'\t' '{printf "[<img src=\"%s\" width=\"80 \" height=\"80\" style=\"border-radius:50%%; \" alt=\"%s\"/>](%s) ", $2, $1, $3}'))</div>"
30+ # Build avatars row for README (small images)
31+ AVATARS=$(echo "$CONTRIBUTORS" | awk -F'\t' '{printf "[<img src=\"%s\" width=\"50 \" height=\"50 \" alt=\"%s\"/>](%s) ", $2, $1, $3}')
3332
34- # --- Update Hall of Fame ---
33+ # ---- Update Hall of Fame - ---
3534 awk -v table="$TABLE" '
36- /<!-- Contributors will be automatically updated by GitHub Actions --> / {
35+ /Contributor \| Contributions / {
3736 print;
37+ print "|-------------|---------------|";
3838 print table;
39- next;
39+ in_block=1; next;
4040 }
41+ in_block && /^\|/ {next}
4142 {print}
4243 ' HALL_OF_FAME.md > temp && mv temp HALL_OF_FAME.md
4344
44- # --- Update README ---
45+ # ---- Update README - ---
4546 awk -v avatars="$AVATARS" '
4647 /<!-- CONTRIBUTORS START -->/ {
4748 print;
@@ -55,18 +56,15 @@ jobs:
5556
5657 - name : Update Implementation Counts
5758 run : |
58- # Update total implementations
5959 sed -i 's/| 🎯 \*\*Total Implementations\*\* | [0-9]\+ |/| 🎯 **Total Implementations** | 22 |/' HALL_OF_FAME.md
60-
61- # Update per-language implementations
6260 sed -i '/### Python/{n;s/- Implementations: [0-9]\+/- Implementations: 6/}' HALL_OF_FAME.md
6361 sed -i '/### C++/{n;s/- Implementations: [0-9]\+/- Implementations: 4/}' HALL_OF_FAME.md
6462 sed -i '/### Java/{n;s/- Implementations: [0-9]\+/- Implementations: 12/}' HALL_OF_FAME.md
6563
66- - name : Commit and Push Changes
64+ - name : Commit changes
6765 run : |
6866 git config --local user.email "actions@github.com"
6967 git config --local user.name "GitHub Actions"
7068 git add HALL_OF_FAME.md README.md
7169 git commit -m "Update contributors and implementations" || echo "No changes to commit"
72- git push
70+ git push
0 commit comments