import { HandlerContext } from "@atomist/automation-client"; import * as slack from "@atomist/slack-messages"; import * as graphql from "../typings/types"; /** * 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. */ export declare function truncateCommitMessage(message: string, repo: any): string; /** * Generate GitHub repository "slug", i.e., owner/repo. * * @param repo repository with .owner and .name * @return owner/name string */ export declare function repoSlug(repo: any): string; /** * Generate valid Slack channel name for a repository name. * * @param repoName valid GitHub repository name * @return valid Slack channel name based on repository name */ export declare function repoChannelName(repoName: string): string; export declare function branchUrl(repo: any, branch: string): string; export declare function htmlUrl(repo: any): string; export declare function commitIcon(repo: any): string; export declare function apiUrl(repo: any): string; export declare function repoUrl(repo: any): string; export declare function repoSlackLink(repo: any): string; export declare function userUrl(repo: any, login: string): string; export declare function avatarUrl(repo: any, login: string, url?: string): string; export declare function commitUrl(repo: any, commit: any): string; export declare function tagUrl(repo: any, tag: any): string; export declare function prUrl(repo: any, pr: any): string; export declare function reviewUrl(repo: any, pr: any, review: any): string; export declare function issueUrl(repo: any, issue: any, comment?: any): string; export declare function labelUrl(repo: any, label: string): string; export declare function isGitHubCom(repo: any): boolean; export declare function isGitHub(repo: any): boolean; export declare function isBitBucket(repo: any): boolean; export declare function isGitlab(repo: any): boolean; export declare function isBitBucketCloud(repo: any): boolean; export declare function isGitlabEnterprise(repo: any): boolean; export declare function isBitBucketOnPrem(repo: any): boolean; export declare const AtomistGeneratedLabel = "atomist:generated"; export declare function isGenerated(node: graphql.PullRequestToPullRequestLifecycle.PullRequest): boolean; /** * 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. * * @param body message body * @return 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. */ export declare function extractImageUrls(body: string): slack.Attachment[]; export declare function extractLinkedIssues(body: string, repo: any, ignore: string[], ctx: HandlerContext): Promise; export declare function loadIssueOrPullRequest(owner: string, repo: string, names: string[], ctx: HandlerContext): Promise; /** * Find issue mentions in body and replace them with links. * * @param body message to modify * @param repo repository information * @return string with issue mentions replaced with links */ export declare function linkIssues(body: string, repo: any): string; export declare function loadChatIdByGitHubId(ctx: HandlerContext, gitHubIds: string[]): Promise; export declare function loadGitHubIdByChatId(chatId: string, teamId: string, ctx: HandlerContext): Promise; export declare function loadChatIdByChatId(chatId: string, teamId: string, ctx: HandlerContext): Promise; export declare function loadChatTeam(teamId: string, ctx: HandlerContext): Promise; export interface ChatId { id?: string; screenName?: string; preferences?: Preferences[]; } export interface Preferences { name?: string; value?: string; } /** * Find all issue mentions and return an array of unique issue * mentions as "#3" and "owner/repo#5". * * @param msg string that may contain mentions * @return unique list of issue mentions as #N or O/R#N */ export declare function getIssueMentions(msg?: string): string[]; /** * Find all valid GitHub @user mentions and return a unique list of them. * * @param msg string possibly containing GitHub user mentions * @return array of unique users mentioned in `msg` */ export declare function getGitHubUsers(msg?: string): string[]; export declare function removeMarkers(body: string): string; export declare function linkGitHubUsers(b: string, context: HandlerContext): Promise; export declare function replaceChatIdWithGitHubId(b: string, teamId: string, ctx: HandlerContext): Promise; export declare function getChatIds(str: string): string[]; export declare function repoAndChannelFooter(repo: any): string; /** * Is login the issue/pr assigner? * @param assignable github issue or PR * @param {string} assigneeLogin github login * @returns {boolean} */ export declare function isAssigner(assignable: any, assigneeLogin: string): boolean; export declare function isDmDisabled(chatId: ChatId, type?: string): boolean; export declare function repoAndlabelsAndAssigneesFooter(repo: any, labels: any, assignees: any[]): string; export declare class ReferencedIssues { issues: graphql.IssueOrPr.Issue[]; prs: graphql.IssueOrPr.PullRequest[]; constructor(issues: graphql.IssueOrPr.Issue[], prs: graphql.IssueOrPr.PullRequest[]); } export declare function getAuthor(commit: graphql.PullRequestFields.Commits): string;