@@ -2,6 +2,12 @@ name: Update Contributors
22
33on :
44 workflow_call :
5+ inputs :
6+ output-format :
7+ description : ' Output format: html (enforces image size) or markdown'
8+ required : false
9+ type : string
10+ default : ' markdown'
511
612jobs :
713 contributors :
1420 - name : Update contributors
1521 env :
1622 GH_TOKEN : ${{ secrets.CONTRIBUTORS_TOKEN }}
23+ OUTPUT_FORMAT : ${{ inputs.output-format }}
1724 run : |
1825 # Fetch code contributors (exclude bots)
1926 code_contributors=$(gh api repos/${{ github.repository }}/contributors --paginate --jq '.[] | select(.type != "Bot") | select(.login | test("\\[bot\\]$") | not) | .login')
4249 other_contributors=$(echo -e "$code_contributors\n$issue_authors" | sort -u | grep -v '^$' | grep -v '^CalvinAllen$' || true)
4350 all_contributors=$(echo -e "CalvinAllen\n$other_contributors" | grep -v '^$')
4451
45- # Build markdown for each contributor
46- contributor_md =""
52+ # Build output for each contributor
53+ contributor_output =""
4754 for login in $all_contributors; do
4855 # Skip bots
4956 if [[ "$login" == *"[bot]" ]]; then
@@ -55,12 +62,18 @@ jobs:
5562 avatar=$(echo "$user_info" | jq -r '.avatar_url')
5663 url=$(echo "$user_info" | jq -r '.html_url')
5764
58- contributor_md="$contributor_md[]($url) "
65+ if [[ "$OUTPUT_FORMAT" == "html" ]]; then
66+ # HTML format with enforced size
67+ contributor_output="$contributor_output<a href=\"$url\"><img src=\"${avatar}&s=64\" width=\"64\" height=\"64\" alt=\"$login\"></a> "
68+ else
69+ # Markdown format (default)
70+ contributor_output="$contributor_output[]($url) "
71+ fi
5972 done
6073
6174 # Build the contributors section
6275 contrib_section="<!-- readme: contributors -start -->
63- $contributor_md
76+ $contributor_output
6477 <!-- readme: contributors -end -->"
6578
6679 # Update README between the markers
0 commit comments