async function handlePullRequest()

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


async function handlePullRequest(data) {
    /* Brand new PR */
    if (data.action && data.action == "opened" && data.pull_request) {
        let owner = data.repository.owner.login || data.organization.login;
        let repo = data.repository.name;
        let pr = data.number;

        await githubPr.createInitialPrComment(owner, repo, pr);

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

        if (configHelper.getFuncPrSummary()) {
            let prSummaryResponse = await aiHelper.prSummary(changeList);
            await githubPr.createPrComment(owner, repo, pr, prSummaryResponse);
        }

        if (configHelper.getFuncDiffSummary()) {
            let diffSummaryResponse = await aiHelper.diffSummary(changeList);
            await githubPr.createPrComment(owner, repo, pr, diffSummaryResponse);
        }

        if (configHelper.getFuncDiffRank()) {
            let diffRankResponse = await aiHelper.diffRank(changeList);
            await githubPr.createPrComment(owner, repo, pr, diffRankResponse);
        }

        if (configHelper.getFuncFileSummary()) {
            let fileSummaryResponse = await aiHelper.fileSummary(changeList);
            await githubPr.createPrComment(owner, repo, pr, fileSummaryResponse);
        }

        if (configHelper.getFuncFilePerformance()) {
            let filePerformanceResponse = await aiHelper.filePerformance(changeList);
            await githubPr.createPrComment(owner, repo, pr, filePerformanceResponse);
        }

        if (configHelper.getFuncFileSecurity()) {
            let fileSecurityResponse = await aiHelper.fileSecurity(changeList);
            await githubPr.createPrComment(owner, repo, pr, fileSecurityResponse);
        }
    }
}