( octokit: Octokit, login: string, userId: string )
| 180 | } |
| 181 | |
| 182 | async function fetchUserDataPaged( |
| 183 | octokit: Octokit, |
| 184 | login: string, |
| 185 | userId: string |
| 186 | ): Promise<Omit<UserData, "profileContent">> { |
| 187 | console.log(`Batching failed. Slowly fetching fresh user data for ${login}`); |
| 188 | const otherData: any = await octokit.graphql(` |
| 189 | query { |
| 190 | user(login: "${login}") { |
| 191 | name |
| 192 | bio |
| 193 | location |
| 194 | status { |
| 195 | emoji |
| 196 | message |
| 197 | } |
| 198 | pullRequests(first: 20, orderBy: { |
| 199 | field: CREATED_AT |
| 200 | direction: DESC |
| 201 | }) { |
| 202 | nodes { |
| 203 | repository { |
| 204 | nameWithOwner |
| 205 | description |
| 206 | } |
| 207 | title |
| 208 | body |
| 209 | createdAt |
| 210 | } |
| 211 | } |
| 212 | } |
| 213 | } |
| 214 | `); |
| 215 | |
| 216 | // Fetch repositories with pagination to get up to 30 repos |
| 217 | let repositoriesData = []; |
| 218 | let hasNextPage = true; |
| 219 | let endCursor = null; |
| 220 | let repoCount = 0; |
| 221 | const maxRepos = 30; // Maximum number of repos to fetch |
| 222 | const perPage = 6; // Number of repos per page |
| 223 | |
| 224 | while (hasNextPage && repoCount < maxRepos) { |
| 225 | const cursorParam = endCursor ? `, after: "${endCursor}"` : ""; |
| 226 | const commitQuery = ` |
| 227 | query { |
| 228 | user(login: "${login}") { |
| 229 | repositoriesContributedTo( |
| 230 | first: ${perPage} |
| 231 | privacy: PUBLIC |
| 232 | orderBy: { |
| 233 | field: UPDATED_AT |
| 234 | direction: DESC |
| 235 | } |
| 236 | includeUserRepositories: true |
| 237 | contributionTypes: [COMMIT] |
| 238 | ${cursorParam} |
| 239 | ) { |
no test coverage detected