MCPcopy Create free account
hub / github.com/dmno-dev/bumpy / resolveBumpFileInfo

Function resolveBumpFileInfo

packages/bumpy/src/core/changelog-github.ts:203–229  ·  view source on GitHub ↗

* 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,
)

Source from the content-addressed store, hash-verified

201 * Summary overrides take precedence over git-derived info.
202 */
203function 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 */
232function lookupPr(prNumber: number, repo?: string): { url: string; author?: string; commitHash?: string } | null {

Callers 1

createGithubFormatterFunction · 0.85

Calls 2

lookupPrFunction · 0.85
findBumpFileCommitInfoFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…