How to use the @atomist/slack-messages.italic 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-core / lib / pack / goal-state / resetGoals.ts View on Github external
branch,
        });

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

        const goals = await chooseAndSetGoals(rules, {
            context: cli.context,
            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-core / lib / pack / goal-state / setGoalState.ts View on Github external
return chi.context.messageClient.respond(msg, { id: chi.parameters.msgId });
            } else {
                const goal = JSON.parse(chi.parameters.goal);
                const goals = await fetchGoalsForCommit(chi.context, id, chi.parameters.providerId);
                const sdmGoal = goals.find(g => (g as any).id === goal.id);

                await updateGoal(chi.context, sdmGoal, {
                    state: chi.parameters.state,
                    description: sdmGoal.description,
                });

                return chi.context.messageClient.respond(
                    slackSuccessMessage(
                        "Set Goal State",
                        `Successfully set state of ${italic(goal.name)} on ${codeLine(sha.slice(0, 7))} of ${
                            bold(`${id.owner}/${id.repo}/${branch}`)} to ${italic(chi.parameters.state)}`),
                    { id: chi.parameters.msgId });
            }
        },
    };
github atomist / sdm / lib / api-helper / command / transform / chattyDryRunAwareEditor.ts View on Github external
async function sendDryRunUpdateMessage(codeTransformName: string,
                                       id: RemoteRepoRef,
                                       params: any,
                                       ctx: HandlerContext): Promise {
    if (!!params[DryRunMsgIdParameter.name]) {
        await ctx.messageClient.respond(
            slackInfoMessage(
                "Code Transform",
                `Applying code transform ${italic(codeTransformName)} to ${bold(slug(id))}`),
            { id: params[DryRunMsgIdParameter.name] });
    }
}
github atomist / sdm-core / lib / pack / goal-state / updateGoal.ts View on Github external
} else if (ci.parameters.state === SdmGoalState.pre_approved) {
                goal.preApproval = prov;
                goal.preApprovalRequired = false;
            }

            goal.state = ci.parameters.state;
            goal.ts = Date.now();
            goal.version = (goal.version || 0) + 1;
            delete (goal as any).id;

            await storeGoal(ci.context, goal as any);
            return ci.context.messageClient.respond(
                slackSuccessMessage(
                    "Set Goal State",
                    `Successfully set state of ${italic(goal.name)} on ${codeLine(goal.sha.slice(0, 7))} of ${
                        bold(`${goal.repo.owner}/${goal.repo.name}/${goal.branch}`)} to ${italic(ci.parameters.state)}`),
                { id: ci.parameters.msgId || guid()});
        },
    };
github atomist / sdm / lib / api-helper / command / transform / codeTransformWrapping.ts View on Github external
return async ci => {
        const target = ci.parameters.targets;
        if (!target || !target.repoRef || !target.repoRef.owner || !target.repoRef.repo) {
            await ci.context.messageClient.respond(
                slackErrorMessage(
                    "Code Transform",
                    `Can only invoke Code Transform ${italic(ci.commandName)} against a single repository. ` +
                    `Please specify ${codeLine("targets.owner")} and ${codeLine("targets.repo")} parameters.`,
                    ci.context));
            return Success;
        }

        const id = ci.ids[0];

        return sdm.configuration.sdm.projectLoader.doWithProject({
            credentials: ci.credentials,
            id,
            readOnly: true,
            context: ci.context,
            cloneOptions: {
                alwaysDeep: false,
            },
        }, async p => {
github atomist / sdm / lib / api-helper / listener / executeAutoInspects.ts View on Github external
return async l => {
        try {
            progressLog.write(`Running review listener ${l.name}...`);
            const result = (await l.listener(rli)) || PushImpactResponse.proceed;
            progressLog.write(`Review listener + ${l.name} result: ` + result);
            return result;
        } catch (err) {
            logger.error("Review listener %s failed. Stack: %s", l.name, err.stack);
            progressLog.write(`Review listener ${l.name} error: ` + err.message);
            progressLog.write(`Failing autoinspect goal because a review listener failed.`);
            await rli.addressChannels(
                slackErrorMessage(
                    "Review Listener",
                    `Review listener ${italic(l.name)} failed${err.message ? `:
${codeBlock(err.message)}` : ""}`,
                    rli.context));
            return PushImpactResponse.failGoals;
        }
    };
}
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 / cancelGoals.ts View on Github external
listener: async ci => {
            const id = ci.parameters.msgId || guid();
            let offset = 0;
            let pgs = await pendingGoalSets(ci.context, sdm.configuration.name, offset);
            const attachments: Attachment[] = [];
            while (pgs.length > 0) {
                for (const pg of pgs) {
                    attachments.push({
                        text: `Pending goal set ${italic(pg.goalSet)} ${codeLine(pg.goalSetId.slice(0, 7))} on ${
                            codeLine(pg.sha.slice(0, 7))} of ${bold(`${pg.repo.owner}/${pg.repo.name}/${pg.branch}`)} is ${italic(pg.state)}`,
                        fallback: pg.goalSet,
                        actions: [
                            buttonForCommand({ text: "Cancel" }, cancelGoalSetsCommand(sdm).name, {
                                goalSetId: pg.goalSetId,
                                msgId: id,
                            }),
                        ],
                    });
                }
                offset = offset + pgs.length;
                pgs = await pendingGoalSets(ci.context, sdm.configuration.name, offset);
            }

            const update: Action = buttonForCommand(
                { text: "Refresh" },
                "ListGoalSets",
github atomist / sdm / lib / api-helper / command / transform / chattyDryRunAwareEditor.ts View on Github external
async function sendSuccessMessage(codeTransformName: string,
                                  id: RemoteRepoRef,
                                  params: any,
                                  ctx: HandlerContext): Promise {
    const msgId = params[DryRunMsgIdParameter.name];
    await ctx.messageClient.respond(
        slackSuccessMessage(
            "Code Transform",
            `Successfully applied code transform ${italic(codeTransformName)} to ${bold(slug(id))}`),
        { id: msgId });
}