* Resolve PR, commit, and author info for a bump file. * Summary overrides take precedence over git-derived info.
( bumpFileId: string, repo: string | undefined, serverUrl: string, overrides: SummaryOverrides, )
| 201 | * Summary overrides take precedence over git-derived info. |
| 202 | */ |
| 203 | function resolveBumpFileInfo( |
| 204 | bumpFileId: string, |
| 205 | repo: string | undefined, |
| 206 | serverUrl: string, |
| 207 | overrides: SummaryOverrides, |
| 208 | ): BumpFileGitInfo { |
| 209 | // If we have a PR override, look it up directly |
| 210 | if (overrides.pr !== undefined) { |
| 211 | const prInfo = lookupPr(overrides.pr, repo); |
| 212 | return { |
| 213 | prNumber: overrides.pr, |
| 214 | prUrl: prInfo?.url ?? `${serverUrl}/${repo}/pull/${overrides.pr}`, |
| 215 | commitHash: overrides.commit ?? prInfo?.commitHash, |
| 216 | author: overrides.authors?.[0] ?? prInfo?.author, |
| 217 | }; |
| 218 | } |
| 219 | |
| 220 | // Otherwise, find the commit that added this bump file |
| 221 | const gitInfo = findBumpFileCommitInfo(bumpFileId, repo); |
| 222 | |
| 223 | return { |
| 224 | prNumber: gitInfo?.prNumber, |
| 225 | prUrl: gitInfo?.prUrl, |
| 226 | commitHash: overrides.commit ?? gitInfo?.commitHash, |
| 227 | author: overrides.authors?.[0] ?? gitInfo?.author, |
| 228 | }; |
| 229 | } |
| 230 | |
| 231 | /** Look up a PR by number using gh CLI */ |
| 232 | function lookupPr(prNumber: number, repo?: string): { url: string; author?: string; commitHash?: string } | null { |
no test coverage detected
searching dependent graphs…