@@ -26,24 +26,31 @@ export async function getAdminService() {
2626
2727export async function getGithubUsersFromGoogle ( ) : Promise < Set < string > > {
2828 const service = await mod . getAdminService ( )
29+ let githubAccounts = new Set < string > ( )
30+ let pageToken = null
2931
30- const userList = await service . users . list ( {
31- customer : 'my_customer' ,
32- maxResults : 250 ,
33- projection : 'custom' ,
34- fields : 'users(customSchemas/Accounts/github(value))' ,
35- customFieldMask : 'Accounts' ,
36- } )
37-
38- const githubAccounts = mod . formatUserList ( userList . data . users )
32+ do {
33+ const userList = await service . users . list ( {
34+ customer : 'my_customer' ,
35+ maxResults : 250 ,
36+ projection : 'custom' ,
37+ fields : 'users(customSchemas/Accounts/github(value)),nextPageToken' ,
38+ customFieldMask : 'Accounts' ,
39+ pageToken : pageToken ,
40+ } )
41+ pageToken = userList . data . nextPageToken
42+ githubAccounts = new Set ( [ ...githubAccounts , ...formatUserList ( userList . data . users ) ] )
43+ } while ( pageToken != null )
3944 return githubAccounts
4045}
4146
4247// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
43- export function formatUserList ( users ) : Set < string > {
48+ export function formatUserList ( users : any [ ] ) : Set < string > {
4449 return new Set (
4550 users
46- . map ( ( user ) => user . customSchemas ?. Accounts ?. github ?. map ( ( account ) => account . value ?. toLowerCase ( ) ) )
51+ . map ( ( user ) =>
52+ user . customSchemas ?. Accounts ?. github ?. map ( ( account : { value : string } ) => account . value ?. toLowerCase ( ) ) ,
53+ )
4754 . flat ( )
4855 . filter ( Boolean ) ,
4956 )
0 commit comments