@@ -17,13 +17,52 @@ jobs:
1717 env :
1818 GH_TOKEN : ${{ secrets.CONTRIBUTORS_TOKEN }}
1919 run : |
20- # Fetch contributors from GitHub API (exclude bots) - markdown format
21- contributors=$(gh api repos/CodingWithCalvin/VsixSdk/contributors --paginate --jq '.[] | select(.type != "Bot") | select(.login | test("\\[bot\\]$") | not) | "[&s=64)](\(.html_url))"' | tr '\n' ' ')
20+ # Fetch code contributors (exclude bots)
21+ code_contributors=$(gh api repos/${{ github.repository }}/contributors --paginate --jq '.[] | select(.type != "Bot") | select(.login | test("\\[bot\\]$") | not) | .login')
22+
23+ # Fetch closed issues and check if they were closed by a merged PR
24+ issue_authors=""
25+ closed_issues=$(gh api "repos/${{ github.repository }}/issues?state=closed" --paginate -q '.[] | select(.pull_request == null) | {number, login: .user.login}')
26+
27+ for row in $(echo "$closed_issues" | jq -c '.'); do
28+ issue_num=$(echo "$row" | jq -r '.number')
29+ login=$(echo "$row" | jq -r '.login')
30+
31+ # Check timeline for cross-referenced merged PR that closed this issue
32+ closed_by_pr=$(gh api repos/${{ github.repository }}/issues/$issue_num/timeline --jq '
33+ [.[] | select(.event == "cross-referenced") |
34+ select(.source.issue.pull_request.merged_at)] |
35+ .[0].source.issue.number // empty')
36+
37+ if [[ -n "$closed_by_pr" ]]; then
38+ issue_authors="$issue_authors$login"$'\n'
39+ fi
40+ done
41+ issue_authors=$(echo "$issue_authors" | sort -u)
42+
43+ # Combine and deduplicate
44+ all_contributors=$(echo -e "$code_contributors\n$issue_authors" | sort -u | grep -v '^$')
45+
46+ # Build markdown for each contributor
47+ contributor_md=""
48+ for login in $all_contributors; do
49+ # Skip bots
50+ if [[ "$login" == *"[bot]" ]]; then
51+ continue
52+ fi
53+
54+ # Get user info
55+ user_info=$(gh api users/$login --jq '{avatar_url, html_url}')
56+ avatar=$(echo "$user_info" | jq -r '.avatar_url')
57+ url=$(echo "$user_info" | jq -r '.html_url')
58+
59+ contributor_md="$contributor_md[]($url) "
60+ done
2261
2362 # Build the contributors section
2463 contrib_section="<!-- readme: contributors -start -->
25- $contributors
26- <!-- readme : contributors -end -->"
64+ $contributor_md
65+ <!-- readme: contributors -end -->"
2766
2867 # Update README between the markers
2968 awk -v contrib="$contrib_section" '
0 commit comments