Options
All
  • Public
  • Public/Protected
  • All
Menu

Class BotComment

This abstract class contains the logic for posting comments to end-user's Merge Request.

Hierarchy

  • BotComment

Index

Methods

Static caseForNewNote

  • caseForNewNote(state: string, updateToggle: boolean): boolean

Static caseForUpdateNote

  • caseForUpdateNote(state: string, updateToggle: boolean): boolean

Static getMRNoteId

  • getMRNoteId(api: GitLabApi): Promise<number>
  • Gets id of oldest merge request note where author's username matches GITLAB_BOT_ACCOUNT_NAME defined in env vars

    Parameters

    • api: GitLabApi

      an instance of the GitLabApi class that wraps HTTP requests to and responses from the GitLab API

    Returns Promise<number>

    id of GRDBot note if it exists, or -1 if no GRDBot note exists

Static post

  • Evaluates parameters to one of three outcomes: posts new note from GRDBot to GitLab Merge Request, updates existing GRDBot note, or takes no action.

    Parameters

    • api: GitLabApi

      an instance of the GitLabApi class that wraps HTTP requests to and responses from the GitLab API

    • state: string

      the state of the incoming Merge Request event from GitLab

    • updateToggle: boolean

      true updates previous GRDBot comment if exists; false always posts new comment

    • comment: string

    Returns Promise<PostORPutResponse>

    1. BotComment with no action response when all messages are "NA"
    2. BotComment with new comment response when state is "open"
    3. BotComment with new comment response when state is "update" but no previous GRDBot comment exists on MR
    4. BotComment with update comment response when state is "update" and previous GRDBot comment exists on MR
    5. BotComment with new comment response when state is "merge" and updateToggle is false
    6. BotComment with new comment response when state is "merge", updateToggle is true, but no previous GRDBot comment exists on MR
    7. BotComment with update comment response when state is "merge", updateToggle is true, and previous GRDBot comment exists on MR

Generated using TypeDoc