<commit_before>"use strict"; // catch errors easier

const github = require("./github.js"); // GitHub wrapper initialization
const issueAreaLabeled = require("./issues/issueAreaLabeled.js"); // issue labeled with area label
const issueReferenced = require("./pullRequests/issueReferenced.js"); // create comment
const commitReference = require("./pullRequests/commitReference.js"); // create comment

module.exports = exports = function(payload) {
  // get necessary information from request body
  const action = payload.action;
  let body, addedLabel; // initialize variables for pull request review (comment) body and added label
  const pullRequestNumber = payload.pull_request.number; // number of PR
  const repoName = payload.repository.name; // PR repository
  const repoOwner = payload.repository.owner.login; // repository owner
  if (action === "opened") { // if pull request was opened
    body = payload.pull_request.body; // contents of PR body
    commitReference(body, pullRequestNumber, repoName, repoOwner);
  } else if (action === "submitted") { // if pull request review was submitted
    body = payload.review.body; // contents of PR review
  } else if (action === "created") { // if PR review comment was created
    body = payload.comment.body; // contents of PR review comment
  } else if (action === "synchronize") { // when PR is synchronized (commits modified)
    commitReference(body, pullRequestNumber, repoName, repoOwner); // check if edited commits reference an issue
    return;
  } else if (action === "labeled") {
    addedLabel = payload.label.name;
    github.issues.getIssueLabels({
      owner: repoOwner,
      repo: repoName,
      number: pullRequestNumber
    }).then((response) => {
      const issueLabelArray = response.data;
      issueAreaLabeled(addedLabel, pullRequestNumber, repoName, repoOwner, issueLabelArray);
      return;
    });
  } else return;
  if (body.match(/#([0-9]+)/) && action !== "opened") issueReferenced(body, pullRequestNumber, repoName, repoOwner);
};<commit_msg>pullRequests.js: Fix null body issue.<commit_after>"use strict"; // catch errors easier

const github = require("./github.js"); // GitHub wrapper initialization
const issueAreaLabeled = require("./issues/issueAreaLabeled.js"); // issue labeled with area label
const issueReferenced = require("./pullRequests/issueReferenced.js"); // create comment
const commitReference = require("./pullRequests/commitReference.js"); // create comment

module.exports = exports = function(payload) {
  // get necessary information from request body
  const action = payload.action;
  let body, addedLabel; // initialize variables for pull request review (comment) body and added label
  const pullRequestNumber = payload.pull_request.number; // number of PR
  const repoName = payload.repository.name; // PR repository
  const repoOwner = payload.repository.owner.login; // repository owner
  if (action === "opened") { // if pull request was opened
    body = payload.pull_request.body; // contents of PR body
    commitReference(body, pullRequestNumber, repoName, repoOwner);
  } else if (action === "submitted") { // if pull request review was submitted
    body = payload.review.body; // contents of PR review
  } else if (action === "created") { // if PR review comment was created
    body = payload.comment.body; // contents of PR review comment
  } else if (action === "synchronize") { // when PR is synchronized (commits modified)
    commitReference(body, pullRequestNumber, repoName, repoOwner); // check if edited commits reference an issue
    return;
  } else if (action === "labeled") {
    addedLabel = payload.label.name;
    github.issues.getIssueLabels({
      owner: repoOwner,
      repo: repoName,
      number: pullRequestNumber
    }).then((response) => {
      const issueLabelArray = response.data;
      issueAreaLabeled(addedLabel, pullRequestNumber, repoName, repoOwner, issueLabelArray);
      return;
    });
  } else return;
  if (body && body.match(/#([0-9]+)/) && action !== "opened") issueReferenced(body, pullRequestNumber, repoName, repoOwner);
};
{'fraction_non_alphanumeric': 0.1206140350877193, 'fraction_numerical': 0.0009746588693957114, 'mean_word_length': 3.9398315282791816, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2535222', 'n_tokens_mistral': 1081, 'n_tokens_neox': 1063, 'n_words': 359}