async function handleComment()

in pull-request-evaluator/lib/github-webhook/event-handler.js [31:72]


async function handleComment(data) {
    let owner = data.repository.owner.login || data.organization.login;
    let repo = data.repository.name;
    let pr = data.issue.number;

    /* getting the pull request and change list */
    let changeList = await githubPr.loadFullPr(owner, repo, pr);

    if (data.comment.body && data.comment.body == "/prSummary") {
        if (configHelper.getFuncPrSummary()) {
            let prSummaryResponse = await aiHelper.prSummary(changeList);
            await githubPr.createPrComment(owner, repo, pr, prSummaryResponse);
        }
    } else if (data.comment.body && data.comment.body == "/diffSummary") {
        if (configHelper.getFuncDiffSummary()) {
            let diffSummaryResponse = await aiHelper.diffSummary(changeList);
            await githubPr.createPrComment(owner, repo, pr, diffSummaryResponse);
        }
    } else if (data.comment.body && data.comment.body == "/diffRank") {
        if (configHelper.getFuncDiffRank()) {
            let diffRankResponse = await aiHelper.diffRank(changeList);
            await githubPr.createPrComment(owner, repo, pr, diffRankResponse);
        }
    } else if (data.comment.body && data.comment.body == "/fileSummary") {
        if (configHelper.getFuncFileSummary()) {
            let fileSummaryResponse = await aiHelper.fileSummary(changeList);
            await githubPr.createPrComment(owner, repo, pr, fileSummaryResponse);
        }
    } else if (data.comment.body && data.comment.body == "/filePerformance") {
        if (configHelper.getFuncFilePerformance()) {
            let filePerformanceResponse = await aiHelper.filePerformance(changeList);
            await githubPr.createPrComment(owner, repo, pr, filePerformanceResponse);
        }
    } else if (data.comment.body && data.comment.body == "/fileSecurity") {
        if (configHelper.getFuncFileSecurity()) {
            let securitySummaryResponse = await aiHelper.fileSecurity(changeList);
            await githubPr.createPrComment(owner, repo, pr, securitySummaryResponse);
        }
    } else if (data.comment.body && data.comment.body == "/help") {
        await githubPr.createHelpPrComment(owner, repo, pr);
    }
}