How to use the @atomist/slack-messages.url function in @atomist/slack-messages

To help you get started, we’ve selected a few @atomist/slack-messages examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github atomist / sdm / lib / api-helper / misc / reportFailureInterpretation.ts View on Github external
retryButton?: slack.Action): Promise {
    if (!interpretation) {
        if (fullLog.url) {
            logger.debug("No log interpretation. Log available at: " + fullLog.url);
            return;
        }
        logger.debug("No log interpretation, no log URL. Sending full log to Slack");
        await addressChannels({
            content: fullLog.log,
            fileType: "text",
            fileName: `${stepName}-failure-${id.sha}.log`,
        } as any);
        return;
    }
    await addressChannels({
        text: `Failed ${stepName} of ${slack.url(`${id.url}/tree/${id.sha}`, id.sha.substr(0, 7))}`,
        attachments: [{
            title: interpretation.message || "Failure",
            title_link: fullLog.url,
            fallback: "relevant bits",
            text: interpretation.relevantPart,
            color: "#ff5050",
            actions: retryButton ? [retryButton] : [],
        }],
    });
    const includeFullLogByDefault = !fullLog.url; // if there is no link, include it by default
    const shouldIncludeFullLog = "includeFullLog" in interpretation ? interpretation.includeFullLog : includeFullLogByDefault;
    if (shouldIncludeFullLog) {
        logger.debug("sending full log to slack. url is %s, includeFullLog is %s", fullLog.url, interpretation.includeFullLog);
        await addressChannels({
            content: fullLog.log,
            fileType: "text",
github atomist / sdm / lib / api-helper / command / generator / generatorCommand.ts View on Github external
...params,
        };
        pi.credentials = await resolveCredentialsPromise(pi.credentials);
        // It's a function that takes the parameters and returns either a project or a RemoteRepoRef
        const rr: RemoteRepoRef | Project | Promise = (startingPoint as any)(pi);
        if (isProjectPromise(rr)) {
            const p = await rr;
            await infoMessage(`Using dynamically chosen starting point project ${bold(`${p.id.owner}:${p.id.repo}`)}`, ctx);
            return p;
        }
        if (isProject(rr)) {
            await infoMessage(`Using dynamically chosen starting point project ${bold(`${rr.id.owner}:${rr.id.repo}`)}`, ctx);
            // params.source will remain undefined in this case
            return rr;
        } else {
            await infoMessage(`Cloning dynamically chosen starting point from ${url(rr.url)}`, ctx);
            params.source = { repoRef: rr };
            return repoLoader(rr);
        }
    }
}
github atomist / sdm / src / util / slack / messages.ts View on Github external
export function supportLink(ctx: HandlerContext): string {
    const supportUrl =
        `https://atomist.typeform.com/to/yvnyOj?message_id=${base64.encode(ctx.invocationId)}`;
    return `${url(supportUrl, "Support")}`;
}
github atomist / sdm / lib / api-helper / code / review / slackReviewListener.ts View on Github external
function reviewCommentToAttachment(grr: GitHubRepoRef, rc: ReviewComment, deepLink: DeepLink): slack.Attachment {
    const link = rc.sourceLocation ? slack.url(deepLink(grr, rc.sourceLocation), "jump to") :
        slack.url(grr.url + "/tree/" + grr.sha, "source");

    return {
        color: "#ff0000",
        author_name: rc.category,
        author_icon: "https://image.shutterstock.com/z/stock-vector-an-image-of-a-red-grunge-x-572409526.jpg",
        text: `${link} ${rc.detail}`,
        mrkdwn_in: ["text"],
        fallback: "error",
        actions: !!rc.fix ? [
            buttonForCommand({text: "Fix"}, rc.fix.command, rc.fix.params),
        ] : [],
    };
}
github atomist / sdm / lib / api-helper / misc / slack / messages.ts View on Github external
export function slackSupportLink(ctx: HandlerContext): string {
    const supportUrl =
        `https://atomist.typeform.com/to/yvnyOj?message_id=${base64.encode(ctx.invocationId)}`;
    return `${slackFooter()} \u00B7 ${url(supportUrl, "Support")}`;
}
github atomist / sdm / lib / api-helper / code / review / slackReviewListener.ts View on Github external
function reviewCommentToAttachment(grr: GitHubRepoRef, rc: ReviewComment, deepLink: DeepLink): slack.Attachment {
    const link = rc.sourceLocation ? slack.url(deepLink(grr, rc.sourceLocation), "jump to") :
        slack.url(grr.url + "/tree/" + grr.sha, "source");

    return {
        color: "#ff0000",
        author_name: rc.category,
        author_icon: "https://image.shutterstock.com/z/stock-vector-an-image-of-a-red-grunge-x-572409526.jpg",
        text: `${link} ${rc.detail}`,
        mrkdwn_in: ["text"],
        fallback: "error",
        actions: !!rc.fix ? [
            buttonForCommand({text: "Fix"}, rc.fix.command, rc.fix.params),
        ] : [],
    };
}