MCPcopy
hub / github.com/promptfoo/promptfoo / postFallbackComments

Function postFallbackComments

code-scan-action/src/main.ts:467–497  ·  view source on GitHub ↗
(
  githubToken: string,
  context: PullRequestContext,
  comments: Comment[],
  review: string | undefined,
  minimumSeverity: string,
)

Source from the content-addressed store, hash-verified

465}
466
467async function postFallbackComments(
468 githubToken: string,
469 context: PullRequestContext,
470 comments: Comment[],
471 review: string | undefined,
472 minimumSeverity: string,
473): Promise<void> {
474 core.info('📝 Server could not post comments - posting as fallback...');
475
476 try {
477 const octokit = github.getOctokit(githubToken);
478 const {
479 lineComments: preparedLineComments,
480 generalComments,
481 reviewBody,
482 } = prepareComments(comments, review, minimumSeverity);
483 const { lineComments, invalidLineComments } = await partitionReviewCommentsByDiff(
484 githubToken,
485 context,
486 preparedLineComments,
487 );
488
489 await postReview(octokit, context, lineComments, reviewBody);
490 await postGeneralComments(octokit, context, [...generalComments, ...invalidLineComments]);
491
492 core.info('✅ All comments posted to PR by action');
493 } catch (error) {
494 core.error(`Failed to post comments: ${formatError(error)}`);
495 core.warning('Comments could not be posted to PR');
496 }
497}
498
499// The shared symlink-safe containment check lives at src/util/isPathWithinDir.ts, but
500// importing it transitively pulls src/logger.ts (and the winston stack) into this bundle,

Callers 1

handleScanResponseFunction · 0.85

Calls 6

prepareCommentsFunction · 0.90
postReviewFunction · 0.85
postGeneralCommentsFunction · 0.85
errorMethod · 0.80
formatErrorFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…