How to use the @atomist/slack-messages.bold 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 / command / generator / generatorCommand.ts View on Github external
code: 0,
            // Redirect to local project page
            redirect: details.redirecter(params.target.repoRef),
            // local SDM uses this to print instructions
            generatedRepositoryUrl: params.target.repoRef.url,
        } as any;
    } catch (err) {
        if (err instanceof CommandListenerExecutionInterruptError) {
            // We're continuing
            return Success as any;
        }

        await ctx.messageClient.respond(
            slackErrorMessage(
                `Create Project`,
                `Project creation for ${bold(`${params.target.repoRef.owner}/${params.target.repoRef.repo}`)} failed:
${codeBlock(err.message)}`,
                ctx));
    }
}
github atomist / sdm / lib / api-helper / command / transform / chattyDryRunAwareEditor.ts View on Github external
codeTransformName,
                {
                    // reuse the other parameters, but set the dryRun flag to false and pin to one repo
                    ...params,
                    "dry-run": false,
                    "dry-run.msgId": msgId,
                    "targets.sha": params.targets.sha,
                    "targets.owner": id.owner,
                    "targets.repo": id.repo,
                }),
        ],
    };
    await ctx.messageClient.respond(
        slackInfoMessage(
            `Code Transform (dry run)`,
            `Code transform ${italic(codeTransformName)} would make the following changes to ${bold(slug(id))}:
${codeBlock(diff)}
`, applyAction), { id: msgId });
}
github atomist / automation-client / test / event / GitLabPush.ts View on Github external
public handle(e: EventFired, ctx: HandlerContext): Promise {
        const push = e.data.GitLabPush[0];
        const text = `${push.commits.length} new ${(push.commits.length > 1 ? "commits" : "commit")} ` +
            `to ${bold(url(push.repository.git_http_url, `${push.user_username}/${push.repository.name}/master`))}`;
        const msg: SlackMessage = {
            text,
            attachments: [{
                fallback: text,
                author_name: `@${push.user_username}`,
                author_icon: push.user_avatar,
                text: push.commits.map(c => `\`${url(c.url, c.id.slice(0, 7))}\` ${c.message.slice(0, 49)}`).join("\n"),
                mrkdwn_in: ["text"],
                color: "#00a5ff",
            },
            ],
        };
        return ctx.messageClient.send(msg, addressSlackChannels("FIXME", "gitlab"))
            .then(() => Success, failure);
    }
}
github atomist / sdm-core / lib / pack / goal-state / resetGoals.ts View on Github external
owner: cli.parameters.targets.repoRef.owner,
                repo: cli.parameters.targets.repoRef.repo,
            });
        } catch (e) {
            const text = `Repository ${bold(slug)} not found`;
            return cli.context.messageClient.respond(slackWarningMessage("Set Goal State", text, cli.context));
        }
        const branch = cli.parameters.targets.repoRef.branch || repoData.defaultBranch;
        let sha;
        try {
            sha = cli.parameters.targets.repoRef.sha || tipOfBranch(repoData, branch);
        } catch (e) {
            return cli.context.messageClient.respond(
                slackWarningMessage(
                    "Set Goal State",
                    `Branch ${bold(branch)} not found on ${bold(slug)}`,
                    cli.context));
        }

        const id = GitHubRepoRef.from({
            owner: cli.parameters.targets.repoRef.owner,
            repo: cli.parameters.targets.repoRef.repo,
            sha,
            branch,
        });

        const push = await fetchPushForCommit(cli.context, id, cli.parameters.providerId);

        const goals = await chooseAndSetGoals(rules, {
            context: cli.context,
            credentials: cli.credentials,
            push,
github atomist / sdm-core / lib / handlers / commands / DisplayDeployEnablement.ts View on Github external
export function reportDeployEnablement(params: SetDeployEnablementParameters,
                                       enabled: boolean,
                                       msgId: string): SlackMessage {
    const text = `Deploy is currently ${enabled ? "enabled" : "disabled"} on ${bold(`${params.owner}/${params.repo}`)}`;
    const actions =
        [buttonForCommand({ text: enabled ? "Disable" : "Enable" },
            enabled ? "DisableDeploy" : "EnableDeploy",
            { ...params, msgId })];
    const msg: SlackMessage = {
        attachments: [{
            author_icon: `https://images.atomist.com/rug/check-circle.gif?gif=${guid()}`,
            author_name: "Deploy Enablement",
            text,
            fallback: text,
            color: enabled ? "#37A745" : "#B5B5B5",
            mrkdwn_in: ["text"],
            actions,
            footer: `${params.name}:${params.version}`,
        }],
    };
github atomist / sdm-core / lib / pack / goal-state / cancelGoals.ts View on Github external
}

    if (result && result.SdmGoalSet && result.SdmGoalSet.length === 1) {
        const gs = result.SdmGoalSet[0];
        const newGoalSet: any = {
            ...gs,
            state: SdmGoalState.canceled,
        };
        await storeGoalSet(ctx, newGoalSet);
    }

    await ctx.messageClient.respond(
        slackInfoMessage(
            "Cancel Goal Set",
            `Canceled goal set ${italic(goalSet.goalSet)} ${codeLine(goalSetId.slice(0, 7))} on ${
                codeLine(goalSet.sha.slice(0, 7))} of ${bold(`${goalSet.repo.owner}/${goalSet.repo.name}/${goalSet.branch}`)}`),
        { id });
}
github atomist / sdm-core / lib / pack / goal-state / resetGoals.ts View on Github external
credentials: cli.credentials,
            push,
        });

        const slugBranch = `${id.owner}/${id.repo}/${push.branch}`;
        if (goals) {
            await cli.addressChannels(slackSuccessMessage(
                "Plan Goals",
                `Successfully planned goals on ${codeLine(push.after.sha.slice(0, 7))} of ${bold(slugBranch)} to ${italic(goals.name)}`,
                {
                    footer: `${cli.parameters.name}:${cli.parameters.version}`,
                }));
        } else {
            await cli.addressChannels(slackWarningMessage(
                "Plan Goals",
                `No goals found for ${codeLine(push.after.sha.slice(0, 7))} of ${bold(slugBranch)}`,
                cli.context,
                {
                    footer: `${cli.parameters.name}:${cli.parameters.version}`,
                }));
        }

        return Success;
    };
}
github atomist / sdm-pack-aspect / lib / job / createFingerprintJob.ts View on Github external
name: repo.name,
                branch: repo.defaultBranch || "master",
            };
        }),
    };

    const prefs: PreferenceStore = configurationValue("sdm.preferenceStoreFactory")(ctx);

    const analyzed = await prefs.get(preferenceKey(org.owner), { scope: PreferenceScope.Sdm, defaultValue: false });
    if (!analyzed) {
        try {
            await createJob({
                    command: calculateFingerprintTask([], []),
                    parameters: repos.tasks,
                    name: `OrganizationAnalysis/${provider.providerId}/${org.owner}`,
                    description: `Analyzing repositories in ${bold(org.owner)}`,
                    concurrentTasks: 1,
                },
                ctx);
            await prefs.put(preferenceKey(org.owner), true, { scope: PreferenceScope.Sdm });
        } catch (e) {
            logger.warn("Failed to create job for org '%s': %s", org.owner, e.message);
        }
    }
}
github atomist / sdm-pack-aspect / lib / job / createFingerprintJob.ts View on Github external
};
            }),
        };
    });

    const prefs: PreferenceStore = configurationValue("sdm.preferenceStoreFactory")(ctx);

    for (const org of orgs) {
        const analyzed = await prefs.get(preferenceKey(org.name), { scope: PreferenceScope.Sdm, defaultValue: false });
        if (!analyzed || rerun) {
            try {
                await createJob({
                        command: calculateFingerprintTask([], []),
                        parameters: org.tasks,
                        name: `OrganizationAnalysis/${org.providerId}/${org.name}`,
                        description: `Analyzing repositories in ${bold(org.name)}`,
                    },
                    ctx);
                await prefs.put(preferenceKey(org.name), true, { scope: PreferenceScope.Sdm });
            } catch (e) {
                logger.warn("Failed to create job for org '%s': %s", org.name, e.message);
            }
        }
    }
}