Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "core/util/lifecycleHelpers"

Index

Variables

Const DefaultGitHubApiUrl

DefaultGitHubApiUrl: "https://api.github.com/" = "https://api.github.com/"

Const gitHubUserMatch

gitHubUserMatch: "[a-zA-Z\d]+(?:-[a-zA-Z\d]+)*" = "[a-zA-Z\d]+(?:-[a-zA-Z\d]+)*"

Const issueMentionMatch

issueMentionMatch: string = `(?:^|(?:${repoIssueMatchPrefix})(${gitHubUserMatch})\/(${gitHubUserMatch})|\\W)#([1-9]\\d*)(?!\\w)`

Const issueMentionRegExp

issueMentionRegExp: RegExp = new RegExp(issueMentionMatch, "g")

Const repoIssueMatchPrefix

repoIssueMatchPrefix: "^|[[\s:({]" = "^|[[\s:({]"

Regular expression to find issue mentions. There are capture groups for the issue repository owner, repository name, and issue number. The capture groups for repository owner and name are optional and therefore may be null, although if one is set, the other should be as well.

The rules for preceding characters is different for current repo matches, e.g., "#43", and other repo matches, e.g., "some/repo#44". Current repo matches allow anything but word characters to precede them. Other repo matches only allow a few other characters to preceed them.

Functions

apiUrl

  • apiUrl(repo: any): string

avatarUrl

  • avatarUrl(repo: any, login: string): string

commitUrl

  • commitUrl(repo: RepoInfo, commit: any): string

extractImageUrls

  • extractImageUrls(body: string): Attachment[]
  • Find image URLs in a message body, returning an array of Slack message attachments, one for each image. It expects the message to be in Slack message markup.

    Parameters

    • body: string

      message body

    Returns Attachment[]

    array of Slack message Attachments with the image_url set to the URL of the image and the text and fallback set to the image name.

getIssueMentions

  • getIssueMentions(msg?: string): string[]
  • Find all issue mentions and return an array of unique issue mentions as "#3" and "owner/repo#5".

    Parameters

    • Default value msg: string = ""

      string that may contain mentions

    Returns string[]

    unique list of issue mentions as #N or O/R#N

htmlUrl

linkIssues

  • linkIssues(body: string, repo: any): string
  • Find issue mentions in body and replace them with links.

    Parameters

    • body: string

      message to modify

    • repo: any

      repository information

    Returns string

    string with issue mentions replaced with links

repoSlug

truncateCommitMessage

  • truncateCommitMessage(message: string, repo: any): string
  • Safely truncate the first line of a commit message to 50 characters or less. Only count printable characters, i.e., not link URLs or markup.

    Parameters

    • message: string
    • repo: any

    Returns string

urlToImageAttachment

  • urlToImageAttachment(url: string): Attachment
  • If the URL is of an image, return a Slack message attachment that will render that image. Otherwise return null.

    Parameters

    • url: string

      full URL

    Returns Attachment

    Slack message attachment for image or null

userUrl

  • userUrl(repo: any, login: string): string

Generated using TypeDoc