diff --git a/.github/slack.yml b/.github/slack.yml index 3c7fac25..88f3f5c5 100644 --- a/.github/slack.yml +++ b/.github/slack.yml @@ -7,7 +7,7 @@ title_link: https://support.github.com text: | *<{{workflowRunUrl}}|Workflow _{{workflow}}_ job _{{jobName}}_ triggered by _{{eventName}}_ is _{{jobStatus}}_>* for <{{refUrl}}|`{{ref}}`> - {{#if description}}<{{diffUrl}}|`{{diffRef}}`> - {{description}}{{/if}} + {{#if description}}<{{diffUrl}}|`{{diffRef}}`> - {{{description}}}{{/if}} {{#if payload.commits}} *Commits* {{#each payload.commits}} @@ -23,7 +23,7 @@ fields: value: "{{#each jobSteps}}{{icon this.outcome}} {{@key}}\n{{/each}}" short: false - title: Workflow - value: "<{{workflowUrl}}|{{workflow}}>" + value: "<{{{workflowUrl}}}|{{workflow}}>" short: true - title: Git Ref value: "{{ref}} ({{refType}})" diff --git a/__tests__/config.test.ts b/__tests__/config.test.ts index f2569d30..be12e077 100644 --- a/__tests__/config.test.ts +++ b/__tests__/config.test.ts @@ -128,7 +128,7 @@ test('custom config of slack action', async () => { { short: true, title: 'Workflow', - value: '' + value: '' }, { short: true, diff --git a/__tests__/fixtures/slack.yml b/__tests__/fixtures/slack.yml index 4f7d6925..a5a3f614 100644 --- a/__tests__/fixtures/slack.yml +++ b/__tests__/fixtures/slack.yml @@ -7,7 +7,7 @@ title_link: https://support.github.com text: | *<{{workflowRunUrl}}|Workflow _{{workflow}}_ job _{{jobName}}_ triggered by _{{eventName}}_ is _{{jobStatus}}_>* for <{{refUrl}}|`{{ref}}`> - {{#if description}}<{{diffUrl}}|`{{diffRef}}`> - {{description}}{{/if}} + {{#if description}}<{{diffUrl}}|`{{diffRef}}`> - {{{description}}}{{/if}} {{#if payload.commits}} *Commits* {{#each payload.commits}} @@ -23,7 +23,7 @@ fields: value: "{{#each jobSteps}}{{icon this.outcome}} {{@key}}\n{{/each}}" short: false - title: Workflow - value: "<{{workflowUrl}}|{{workflow}}>" + value: "<{{{workflowUrl}}}|{{workflow}}>" short: true - title: Git Ref value: "{{ref}} ({{refType}})" diff --git a/__tests__/inputs.test.ts b/__tests__/inputs.test.ts index 751d1c71..a6fe3c61 100644 --- a/__tests__/inputs.test.ts +++ b/__tests__/inputs.test.ts @@ -121,7 +121,7 @@ test('custom config of slack action', async () => { { short: true, title: 'Workflow', - value: '' + value: '' }, { short: true, diff --git a/__tests__/job_status.test.ts b/__tests__/job_status.test.ts index 6eb061fc..d1b05570 100644 --- a/__tests__/job_status.test.ts +++ b/__tests__/job_status.test.ts @@ -103,7 +103,7 @@ test('push event to slack', async () => { mrkdwn_in: ['pretext', 'text', 'fields'], pretext: '', text: - '** for \n - 4 commits', + '** for \n - 4 commits', title: '', fields: [ { diff --git a/__tests__/pull_request.test.ts b/__tests__/pull_request.test.ts index ed6d56de..70c42c2f 100644 --- a/__tests__/pull_request.test.ts +++ b/__tests__/pull_request.test.ts @@ -70,7 +70,7 @@ test('pull request event to slack', async () => { mrkdwn_in: ['pretext', 'text', 'fields'], pretext: '', text: - '** for \n - Rename to slack', + '** for \n - Rename to slack', title: '', fields: [], footer: ' #760', diff --git a/__tests__/push.test.ts b/__tests__/push.test.ts index dc45fe03..bb2bad17 100644 --- a/__tests__/push.test.ts +++ b/__tests__/push.test.ts @@ -70,7 +70,7 @@ test('push event to slack', async () => { mrkdwn_in: ['pretext', 'text', 'fields'], pretext: '', text: - '** for \n - 4 commits', + '** for \n - 4 commits', title: '', fields: [], footer: ' #8', diff --git a/__tests__/release.test.ts b/__tests__/release.test.ts index 89aa60d4..945a6689 100644 --- a/__tests__/release.test.ts +++ b/__tests__/release.test.ts @@ -73,7 +73,7 @@ test('release event to slack', async () => { mrkdwn_in: ['pretext', 'text', 'fields'], pretext: '', text: - '** for \n', + '** for \n', title: '', fields: [], footer: ' #817', diff --git a/__tests__/schedule.test.ts b/__tests__/schedule.test.ts index 59b8bcf2..534089a8 100644 --- a/__tests__/schedule.test.ts +++ b/__tests__/schedule.test.ts @@ -66,7 +66,7 @@ test('schedule event to slack', async () => { mrkdwn_in: ['pretext', 'text', 'fields'], pretext: '', text: - '** for \n - Schedule `*/15 * * * *`', + '** for \n - Schedule `*/15 * * * *`', title: '', fields: [], footer: ' #179', diff --git a/__tests__/workflow_dispatch.test.ts b/__tests__/workflow_dispatch.test.ts index 34a8e7e0..5fc70c61 100644 --- a/__tests__/workflow_dispatch.test.ts +++ b/__tests__/workflow_dispatch.test.ts @@ -71,7 +71,7 @@ test('workflow_dispatch event to slack', async () => { mrkdwn_in: ['pretext', 'text', 'fields'], pretext: '', text: - '** for \n', + '** for \n', title: '', fields: [], footer: ' #6', diff --git a/dist/index.js b/dist/index.js index be0c7bf5..f307e2d3 100644 --- a/dist/index.js +++ b/dist/index.js @@ -13387,9 +13387,9 @@ function send(url, jobName, jobStatus, jobSteps, channel, message, opts) { }); const pretextTemplate = handlebars_1.default.compile((opts === null || opts === void 0 ? void 0 : opts.pretext) || ''); const titleTemplate = handlebars_1.default.compile((opts === null || opts === void 0 ? void 0 : opts.title) || ''); - const defaultText = `${'*<{{workflowUrl}}|Workflow _{{workflow}}_ ' + + const defaultText = `${'*<{{{workflowUrl}}}|Workflow _{{workflow}}_ ' + 'job _{{jobName}}_ triggered by _{{eventName}}_ is _{{jobStatus}}_>* ' + - 'for <{{refUrl}}|`{{ref}}`>\n'}${description ? '<{{diffUrl}}|`{{diffRef}}`> - {{description}}' : ''}`; + 'for <{{refUrl}}|`{{ref}}`>\n'}${description ? '<{{diffUrl}}|`{{diffRef}}`> - {{{description}}}' : ''}`; const textTemplate = handlebars_1.default.compile(message || (opts === null || opts === void 0 ? void 0 : opts.text) || defaultText); const defaultFallback = `[GitHub]: [{{repositoryName}}] {{workflow}} {{eventName}} ${action ? '{{action}} ' : ''}{{jobStatus}}`; const fallbackTemplate = handlebars_1.default.compile((opts === null || opts === void 0 ? void 0 : opts.fallback) || defaultFallback); diff --git a/src/slack.ts b/src/slack.ts index afcde1fc..f22090c9 100644 --- a/src/slack.ts +++ b/src/slack.ts @@ -171,10 +171,10 @@ export async function send( const titleTemplate = Handlebars.compile(opts?.title || '') const defaultText = `${ - '*<{{workflowUrl}}|Workflow _{{workflow}}_ ' + + '*<{{{workflowUrl}}}|Workflow _{{workflow}}_ ' + 'job _{{jobName}}_ triggered by _{{eventName}}_ is _{{jobStatus}}_>* ' + 'for <{{refUrl}}|`{{ref}}`>\n' - }${description ? '<{{diffUrl}}|`{{diffRef}}`> - {{description}}' : ''}` + }${description ? '<{{diffUrl}}|`{{diffRef}}`> - {{{description}}}' : ''}` const textTemplate = Handlebars.compile(message || opts?.text || defaultText) const defaultFallback = `[GitHub]: [{{repositoryName}}] {{workflow}} {{eventName}} ${