File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -136,7 +136,7 @@ export default class Changelog {
136136 const shouldKeepCommiter = login && ! this . ignoreCommitter ( login ) ;
137137
138138 if ( login && shouldKeepCommiter && ! committers [ login ] ) {
139- committers [ login ] = await this . github . getUserData ( user ) ;
139+ committers [ login ] = this . sanitizeCommitter ( await this . github . getUserData ( user ) ) ;
140140 }
141141 }
142142
@@ -147,6 +147,15 @@ export default class Changelog {
147147 return this . config . ignoreCommitters . some ( ( c : string ) => c === login || login . indexOf ( c ) > - 1 ) ;
148148 }
149149
150+ private sanitizeCommitter ( contributor : GitHubContributor ) {
151+ // Response for Copilot is "Copilot SWE Agent" - but we prefer "Copilot"
152+ if ( contributor . login === "Copilot" ) {
153+ contributor . name = "Copilot" ;
154+ }
155+
156+ return contributor ;
157+ }
158+
150159 private toCommitInfos ( commits : Git . CommitListItem [ ] ) : CommitInfo [ ] {
151160 return commits . map ( commit => {
152161 const { sha, refName, summary : message , date } = commit ;
Original file line number Diff line number Diff line change @@ -65,19 +65,14 @@ export default class GithubAPI {
6565 let login = userInfo . login ;
6666 let path = "users" ;
6767
68+ // github API itself does not tell if contributor is an app. Best guess was to
69+ // check the `html_url` for the `/apps/` segment
6870 if ( userInfo . html_url && userInfo . html_url . includes ( "/apps/" ) ) {
6971 path = "apps" ;
7072 login = userInfo . html_url . split ( "/" ) . pop ( ) as string ;
7173 }
7274 const prefix = process . env . GITHUB_API_URL || `https://api.${ this . github } ` ;
73- const data = await this . _fetch ( `${ prefix } /${ path } /${ login } ` ) ;
74-
75- if ( login === "Copilot" ) {
76- // Response for Copilot is "Copilot SWE Agent" - but we prefer "Copilot"
77- data . name = "Copilot" ;
78- }
79-
80- return data ;
75+ return await this . _fetch ( `${ prefix } /${ path } /${ login } ` ) ;
8176 }
8277
8378 private async _fetch ( url : string ) : Promise < any > {
You can’t perform that action at this time.
0 commit comments