(nodes: any)
| 51 | } |
| 52 | |
| 53 | function parseCommits(nodes: any): Repository[] { |
| 54 | return nodes |
| 55 | .filter( |
| 56 | (repo: any) => |
| 57 | repo !== null && |
| 58 | repo.mainCommits !== null && |
| 59 | repo.mainCommits.target !== null |
| 60 | ) |
| 61 | .map((repo: any) => { |
| 62 | const { nameWithOwner, description, mainCommits } = repo; |
| 63 | // Handle null mainCommits with optional chaining and default to empty array |
| 64 | const nodes = mainCommits?.target?.history?.nodes; |
| 65 | const commits = |
| 66 | nodes?.map((commit: any) => { |
| 67 | return { |
| 68 | message: commit.message, |
| 69 | committedDate: new Date(commit.committedDate).toLocaleString( |
| 70 | "zh-CN" |
| 71 | ), |
| 72 | }; |
| 73 | }) || []; |
| 74 | return { |
| 75 | nameWithOwner, |
| 76 | description, |
| 77 | commits: commits.filter((commit: any) => commit !== null), |
| 78 | }; |
| 79 | }) |
| 80 | .filter((repo: any) => repo.commits && repo.commits.length > 0); |
| 81 | } |
| 82 | |
| 83 | function parsePullRequests(nodes: any): PullRequest[] { |
| 84 | return nodes.map((pr) => { |
no outgoing calls
no test coverage detected