@@ -172,28 +172,57 @@ export class GithubRepositoryProvider implements RepositoryProvider {
172
172
}
173
173
174
174
async getUserRepos ( user : User ) : Promise < string [ ] > {
175
- // Hint: Use this to get richer results:
176
- // node {
177
- // nameWithOwner
178
- // shortDescriptionHTML(limit: 120)
179
- // url
180
- // }
181
175
const result : any = await this . githubQueryApi . runQuery (
182
176
user ,
183
177
`
184
- query {
178
+ fragment Repos on RepositoryConnection {
179
+ nodes {
180
+ url
181
+ }
182
+ }
183
+
184
+ query topRepositories {
185
185
viewer {
186
- repositoriesContributedTo(includeUserRepositories: true, first: 100) {
187
- edges {
188
- node {
189
- url
190
- }
191
- }
192
- }
186
+ contributedTo: repositoriesContributedTo(
187
+ first: 100
188
+ orderBy: {field: PUSHED_AT, direction: DESC}
189
+ includeUserRepositories: true
190
+ contributionTypes: [COMMIT]
191
+ ) {
192
+ ...Repos
193
+ }
194
+ original: repositories(
195
+ first: 100
196
+ ownerAffiliations: OWNER
197
+ privacy: PUBLIC
198
+ isFork: false
199
+ isLocked: false
200
+ orderBy: {field: UPDATED_AT, direction: DESC}
201
+ ) {
202
+ ...Repos
203
+ }
204
+ forked: repositories(
205
+ first: 100
206
+ ownerAffiliations: OWNER
207
+ privacy: PUBLIC
208
+ isFork: true
209
+ isLocked: false
210
+ orderBy: {field: UPDATED_AT, direction: DESC}
211
+ ) {
212
+ ...Repos
213
+ }
193
214
}
194
- }` ,
215
+ }` ,
195
216
) ;
196
- return ( result . data . viewer ?. repositoriesContributedTo ?. edges || [ ] ) . map ( ( edge : any ) => edge . node . url ) ;
217
+
218
+ const urls = [ ] ;
219
+ for ( const type of [ "contributedTo" , "original" , "forked" ] ) {
220
+ const nodes = result . data . viewer [ type ] ?. nodes ;
221
+ if ( nodes ) {
222
+ urls . push ( nodes . map ( ( n : any ) => n ?. url ) . filter ( ( u : any ) => typeof u === "string" ) ) ;
223
+ }
224
+ }
225
+ return urls ;
197
226
}
198
227
199
228
async hasReadAccess ( user : User , owner : string , repo : string ) : Promise < boolean > {
0 commit comments