async handlePullRequestEvent()

in functions/src/pullrequests.ts [63:99]


  async handlePullRequestEvent(
    event: types.github.WebhookEvent,
    action: PullRequestAction,
    pr: types.github.PullRequest,
    repo: types.github.Repository,
    sender: types.github.Sender
  ): Promise<types.Action[]> {
    switch (action) {
      case PullRequestAction.OPENED:
        return this.onNewPullRequest(repo, pr);
      case PullRequestAction.LABELED:
        return this.onPullRequestLabeled(repo, pr, event.label.name);
      case PullRequestAction.ASSIGNED:
      /* falls through */
      case PullRequestAction.UNASSIGNED:
      /* falls through */
      case PullRequestAction.REVIEW_REQUESTED:
      /* falls through */
      case PullRequestAction.REVIEW_REQUEST_REMOVED:
      /* falls through */
      case PullRequestAction.UNLABLED:
      /* falls through */
      case PullRequestAction.EDITED:
      /* falls through */
      case PullRequestAction.CLOSED:
      /* falls through */
      case PullRequestAction.REOPENED:
      /* falls through */
      default:
        log.debug("Unsupported pull request action: " + action);
        log.debug("Pull Request: " + pr.title);
        break;
    }

    // Return empty action array if no action to be taken.
    return Promise.resolve([]);
  }