MCPcopy Index your code
hub / github.com/dmno-dev/bumpy / ciCommentCommand

Function ciCommentCommand

packages/bumpy/src/commands/ci.ts:306–338  ·  view source on GitHub ↗
(rootDir: string, opts: CommentOptions)

Source from the content-addressed store, hash-verified

304 * repo's comment onto an arbitrary PR or issue.
305 */
306export async function ciCommentCommand(rootDir: string, opts: CommentOptions): Promise<void> {
307 if (!opts.bodyFile) {
308 log.error('`bumpy ci comment` requires --body-file <path>.');
309 process.exit(1);
310 }
311
312 // Let gh resolve the repo without a checkout (the poster workflow may not check
313 // anything out). GITHUB_REPOSITORY is set by Actions and is trusted.
314 if (!process.env.GH_REPO && process.env.GITHUB_REPOSITORY) {
315 process.env.GH_REPO = process.env.GITHUB_REPOSITORY;
316 }
317
318 let body: string;
319 try {
320 body = readFileSync(resolve(opts.bodyFile), 'utf-8');
321 } catch {
322 // No body file — normal when the PR had no bump-file changes (empty artifact). No-op.
323 log.dim(` No comment body at ${opts.bodyFile} — nothing to post.`);
324 return;
325 }
326 if (!body.trim()) {
327 log.dim(' Empty comment body — nothing to post.');
328 return;
329 }
330
331 const prNumber = opts.pr ? validatePrNumber(opts.pr) : resolveTargetPrNumber(rootDir);
332 if (!prNumber) {
333 log.error('Could not resolve a target PR. Pass --pr <number> explicitly.');
334 process.exit(1);
335 }
336
337 await postOrUpdatePrComment(prNumber, body, rootDir);
338}
339
340/**
341 * Resolve which PR to comment on. Under `workflow_run`, derive it from the TRUSTED

Callers 2

ci-comment.test.tsFile · 0.90
mainFunction · 0.85

Calls 3

validatePrNumberFunction · 0.85
resolveTargetPrNumberFunction · 0.85
postOrUpdatePrCommentFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…