@@ -14,11 +14,10 @@ export interface GitHubContributor {
1414 role : Role
1515 sponsors_url : string | null
1616 bio : string | null
17- twitterUsername : string | null
1817 socialAccounts : SocialAccount [ ]
1918}
2019
21- type GitHubAPIContributor = Omit < GitHubContributor , 'role' | 'sponsors_url' | 'bio' | 'twitterUsername' | ' socialAccounts'>
20+ type GitHubAPIContributor = Omit < GitHubContributor , 'role' | 'sponsors_url' | 'bio' | 'socialAccounts' >
2221
2322// Fallback when no GitHub token is available (e.g. preview environments).
2423// Only stewards are shown as maintainers; everyone else is a contributor.
@@ -71,7 +70,6 @@ async function fetchTeamMembers(token: string): Promise<TeamMembers | null> {
7170interface GovernanceProfile {
7271 hasSponsorsListing : boolean
7372 bio : string | null
74- twitterUsername : string | null
7573 socialAccounts : SocialAccount [ ]
7674}
7775
@@ -94,6 +92,7 @@ async function fetchGovernanceProfiles(
9492 socialAccounts(first: 10) { nodes { provider url } }
9593 }` ,
9694 )
95+ // twitterUsername is fetched to normalise it into socialAccounts below
9796 const query = `{ ${ fragments . join ( '\n' ) } }`
9897
9998 try {
@@ -126,14 +125,20 @@ async function fetchGovernanceProfiles(
126125 if ( json . data ) {
127126 for ( const user of Object . values ( json . data ) ) {
128127 if ( user ) {
128+ const socialAccounts : SocialAccount [ ] = user . socialAccounts . nodes . map ( n => ( {
129+ provider : n . provider ,
130+ url : n . url ,
131+ } ) )
132+ // Normalise twitterUsername into socialAccounts so callers have a
133+ // single unified array. GitHub returns it separately because it
134+ // predates the socialAccounts field.
135+ if ( user . twitterUsername && ! socialAccounts . some ( a => a . provider === 'TWITTER' ) ) {
136+ socialAccounts . unshift ( { provider : 'TWITTER' , url : `https://x.com/${ user . twitterUsername } ` } )
137+ }
129138 profiles . set ( user . login , {
130139 hasSponsorsListing : user . hasSponsorsListing ,
131140 bio : user . bio ,
132- twitterUsername : user . twitterUsername ,
133- socialAccounts : user . socialAccounts . nodes . map ( n => ( {
134- provider : n . provider ,
135- url : n . url ,
136- } ) ) ,
141+ socialAccounts,
137142 } )
138143 }
139144 }
@@ -221,9 +226,8 @@ export default defineCachedEventHandler(
221226 ? `https://github.com/sponsors/${ c . login } `
222227 : null
223228 const bio = profile ?. bio ?? null
224- const twitterUsername = profile ?. twitterUsername ?? null
225229 const socialAccounts = profile ?. socialAccounts ?? [ ]
226- Object . assign ( c , { role, order, sponsors_url, bio, twitterUsername , socialAccounts } )
230+ Object . assign ( c , { role, order, sponsors_url, bio, socialAccounts } )
227231 return c as GitHubContributor & { order : number }
228232 } )
229233 . sort ( ( a , b ) => a . order - b . order || b . contributions - a . contributions )
0 commit comments