Skip to content

Commit c153f42

Browse files
committed
updated configs
1 parent 87e1ef5 commit c153f42

1 file changed

Lines changed: 47 additions & 42 deletions

File tree

.github/workflows/update-contributors.yml

Lines changed: 47 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,26 @@ jobs:
2828
- name: 🏆 Update contributors list
2929
run: |
3030
set -x
31-
CONTRIBUTORS=$(curl -s "https://api.github.com/repos/${{ github.repository }}/contributors?per_page=100" | jq -r '.[] | select(.type != "Bot") | @base64 "\(.login), \(.avatar_url), \(.contributions)"')
32-
3331
{
3432
echo "<div align=\"center\">";
3533
echo " <a href=\"https://github.com/admirerr/DSA-Collection/graphs/contributors\">";
36-
37-
for c in $CONTRIBUTORS; do
38-
DECODED=$(echo "$c" | base64 -d)
39-
IFS=',' read -r login avatar_url contributions <<< "$DECODED"
40-
echo " <img src=\"${avatar_url}&s=50\" width=\"50\" height=\"50\" alt=\" ${login}\" />";
41-
done
42-
34+
} > contributors.html
35+
36+
curl -s "https://api.github.com/repos/${{ github.repository }}/contributors?per_page=100" | \
37+
jq -r '.[] | select(.type != "Bot") | @base64 "\(.login), \(.avatar_url), \(.contributions)"' | \
38+
while read -r c; do
39+
if [ -z "$c" ]; then
40+
continue
41+
fi
42+
DECODED=$(echo "$c" | base64 -d)
43+
IFS=',' read -r login avatar_url contributions <<< "$DECODED"
44+
echo " <img src=\"${avatar_url}&s=50\" width=\"50\" height=\"50\" alt=\"${login}\"/>" >> contributors.html
45+
done
46+
47+
{
4348
echo " </a>";
4449
echo "</div>";
45-
} > contributors.html
50+
} >> contributors.html
4651
4752
python << EOF
4853
import re
@@ -64,7 +69,7 @@ jobs:
6469
6570
- name: 📈 Update language statistics
6671
run: |
67-
echo "📈 Updating language statistics...";
72+
echo "📈 Updating language statistics..."
6873
6974
# Count files by language
7075
cpp_files=$(find CPP/ -name "*.cpp" 2>/dev/null | wc -l || echo 0)
@@ -73,16 +78,16 @@ jobs:
7378
7479
total_implementations=$((cpp_files + java_files + python_files))
7580
76-
echo "📊 Language Statistics:";
77-
echo "C++: $cpp_files files";
78-
echo "Java: $java_files files";
79-
echo "Python: $python_files files";
80-
echo "Total: $total_implementations implementations";
81+
echo "📊 Language Statistics:"
82+
echo "C++: $cpp_files files"
83+
echo "Java: $java_files files"
84+
echo "Python: $python_files files"
85+
echo "Total: $total_implementations implementations"
8186
8287
# Count supported languages
8388
supported_languages=3 # Base languages: C++, Java, Python
8489
85-
echo "Supported languages: $supported_languages";
90+
echo "Supported languages: $supported_languages"
8691
8792
# Update README stats
8893
if [ -f "README.md" ]; then
@@ -91,53 +96,53 @@ jobs:
9196
9297
- name: 📅 Update last modified date
9398
run: |
94-
echo "📅 Updating last modified date...";
99+
echo "📅 Updating last modified date..."
95100
current_date=$(date +"%B %Y")
96101
97102
if [ -f "HALL_OF_FAME.md" ]; then
98103
sed -i "s/\*Last updated: .* [0-9]*\*/\*Last updated: $current_date\*/g" HALL_OF_FAME.md
99-
echo "✅ Updated last modified date in HALL_OF_FAME.md";
104+
echo "✅ Updated last modified date in HALL_OF_FAME.md"
100105
fi
101106
102107
- name: 🔍 Check for changes
103108
id: changes
104109
run: |
105110
if git diff --quiet; then
106-
echo "No changes to commit";
107-
echo "has_changes=false" >> $GITHUB_OUTPUT;
111+
echo "No changes to commit"
112+
echo "has_changes=false" >> $GITHUB_OUTPUT
108113
else
109-
echo "Changes detected";
110-
echo "has_changes=true" >> $GITHUB_OUTPUT;
111-
echo "Changed files:";
112-
git diff --name-only;
114+
echo "Changes detected"
115+
echo "has_changes=true" >> $GITHUB_OUTPUT
116+
echo "Changed files:"
117+
git diff --name-only
113118
fi
114119
115120
- name: 💾 Commit and push changes
116121
if: steps.changes.outputs.has_changes == 'true'
117122
run: |
118-
git config --local user.email "action@github.com";
119-
git config --local user.name "GitHub Action";
123+
git config --local user.email "action@github.com"
124+
git config --local user.name "GitHub Action"
120125
121-
git add README.md HALL_OF_FAME.md;
126+
git add README.md HALL_OF_FAME.md
122127
123-
git commit -m "🏆 Auto-update contributor statistics";
128+
git commit -m "🏆 Auto-update contributor statistics"
124129
125-
git push;
130+
git push
126131
127132
- name: 📋 Generate summary
128133
run: |
129-
echo "🏆 Contributors Update Summary";
130-
echo "==============================";
131-
echo "";
132-
echo "📊 Statistics:";
133-
echo " 👥 Total Contributors: ${{ steps.contributors.outputs.total_contributors }}";
134-
echo " 🔥 Repository Status: Active";
135-
echo " 📅 Last Updated: $(date)";
136-
echo "";
137-
echo "🎉 Contributor statistics updated successfully!";
134+
echo "🏆 Contributors Update Summary"
135+
echo "=============================="
136+
echo ""
137+
echo "📊 Statistics:"
138+
echo " 👥 Total Contributors: ${{ steps.contributors.outputs.total_contributors }}"
139+
echo " 🔥 Repository Status: Active"
140+
echo " 📅 Last Updated: $(date)"
141+
echo ""
142+
echo "🎉 Contributor statistics updated successfully!"
138143
139144
if [ "${{ steps.changes.outputs.has_changes }}" == "true" ]; then
140-
echo "✅ Changes committed and pushed";
145+
echo "✅ Changes committed and pushed"
141146
else
142-
echo "ℹ️ No changes needed";
143-
fi
147+
echo "ℹ️ No changes needed"
148+
fi

0 commit comments

Comments
 (0)