<commit_before>package models.actions

import models.GitHubAction
import github.GitHubAPI
import github.GitHubEvent
import github.events.PullRequestEvent
import github.events.IssueCommentEvent
import github.enums.PullRequestAction


class ReviewMeAction extends GitHubAction {
  private def isPullRequestOpen(msg: GitHubEvent) = msg match {
    case x: PullRequestEvent => x.action == PullRequestAction.opened
    case _ => false
  }
  private def isIssueComment(msg: GitHubEvent) = msg.name == "issue_comment"

  def isMatch(msg: GitHubEvent): Boolean = {
println("test1, " + isPullRequestOpen(msg) + ", " + isIssueComment(msg))
    isPullRequestOpen(msg) || isIssueComment(msg)
  }
  def process(api: GitHubAPI, msg: GitHubEvent): Unit = {
    val (text, number) = msg match {
      case x: PullRequestEvent => (x.pull_request.body, x.pull_request.number)
      case x: IssueCommentEvent => (x.comment.body, x.issue.number)
    }
println("test2, " + text)
    text.split("\n").map(_.split("\t\\., ")).filter { words =>
      words.find(_.startsWith("@")).isDefined && 
      words.find(_.equalsIgnoreCase("review")).isDefined
    }.headOption.foreach { words =>
      val reviewee = words.find(_.startsWith("@")).map(_.substring(1))
println("test3, " + number + ", " + reviewee)
      api.addLabels(number, "Review me!")
      reviewee.foreach(api.assign(number, _))
    }
  }
}<commit_msg>Add debug log<commit_after>package models.actions

import models.GitHubAction
import github.GitHubAPI
import github.GitHubEvent
import github.events.PullRequestEvent
import github.events.IssueCommentEvent
import github.enums.PullRequestAction


class ReviewMeAction extends GitHubAction {
  private def isPullRequestOpen(msg: GitHubEvent) = msg match {
    case x: PullRequestEvent => x.action == PullRequestAction.opened
    case _ => false
  }
  private def isIssueComment(msg: GitHubEvent) = msg.name == "issue_comment"

  def isMatch(msg: GitHubEvent): Boolean = {
println("test1, " + isPullRequestOpen(msg) + ", " + isIssueComment(msg))
    isPullRequestOpen(msg) || isIssueComment(msg)
  }
  def process(api: GitHubAPI, msg: GitHubEvent): Unit = {
    val (text, number) = msg match {
      case x: PullRequestEvent => (x.pull_request.body, x.pull_request.number)
      case x: IssueCommentEvent => (x.comment.body, x.issue.number)
    }
println("test2, " + text)
    text.split("\n").map(_.split("\t\\., ")).filter { words =>
println("test3, " + words)
println("test4, " + words.find(_.startsWith("@")) + ", " + words.find(_.equalsIgnoreCase("review")))
      words.find(_.startsWith("@")).isDefined && 
      words.find(_.equalsIgnoreCase("review")).isDefined
    }.headOption.foreach { words =>
      val reviewee = words.find(_.startsWith("@")).map(_.substring(1))
println("test5, " + number + ", " + reviewee)
      api.addLabels(number, "Review me!")
      reviewee.foreach(api.assign(number, _))
    }
  }
}
{'fraction_non_alphanumeric': 0.14903846153846154, 'fraction_numerical': 0.003434065934065934, 'mean_word_length': 4.239208633093525, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '1871407', 'n_tokens_mistral': 979, 'n_tokens_neox': 926, 'n_words': 179}