Skip to content

Commit

Permalink
[slack] Add Accessory interface
Browse files Browse the repository at this point in the history
  • Loading branch information
homoluctus committed Nov 12, 2019
1 parent d715676 commit 024d5a0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10983,8 +10983,8 @@ class Slack extends webhook_1.IncomingWebhook {
if (status === 'always') {
throw new Error('"always" cannot be specified with "type" parameter');
}
const color = Slack.accessory[status]['color'];
const result = Slack.accessory[status]['result'];
const color = Slack.accessory[status]['color'];
const mentionText = this.isMention(mentionCondition, status) ? mention : '';
let text = `${jobName} ${result}`;
if (mentionText !== '') {
Expand Down
15 changes: 13 additions & 2 deletions src/slack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,19 @@ import {
IncomingWebhookResult
} from '@slack/webhook';

interface AccessoryDesign {
color: string;
result: string;
}

interface Accessory {
failure: AccessoryDesign;
success: AccessoryDesign;
cancelled: AccessoryDesign;
}

export class Slack extends IncomingWebhook {
static readonly accessory: object = {
static readonly accessory: Accessory = {
failure: {
color: '#cb2431',
result: 'Failed'
Expand Down Expand Up @@ -94,8 +105,8 @@ export class Slack extends IncomingWebhook {
throw new Error('"always" cannot be specified with "type" parameter')
}

const color: string = Slack.accessory[status]['color'];
const result: string = Slack.accessory[status]['result'];
const color: string = Slack.accessory[status]['color'];
const mentionText: string = this.isMention(mentionCondition, status) ? mention : '';
let text: string = `${jobName} ${result}`;

Expand Down

0 comments on commit 024d5a0

Please sign in to comment.