Repository: 8398a7/action-slack (ts)

Issue:
“Job is not found. Check the matrix.”
**Describe the bug**
About two weeks ago the job field of our Github Action reports in Slack changed to report “Job is not found. Check the matrix.” The Action configuration has not changed in that time. To our knowledge nothing related to the Github Action or our git workflow or team activity has changed.

**Expected behavior**
The expected behavior is the Slack message produced by the action to include the job name from the Githhub action configuration.

**Screenshots**
Here is a sample report in Slack before the behavior changed.
<img width="663" alt="Screen Shot 2020-09-03 at 12 04 40 PM" src="https://user-images.githubusercontent.com/1048550/92139949-7b936000-edde-11ea-8413-fdb52a3d82ad.png">

Here is a sample report in Slack after the behavior changed:
<img width="665" alt="Screen Shot 2020-09-03 at 12 04 12 PM" src="https://user-images.githubusercontent.com/1048550/92139947-7afac980-edde-11ea-969d-04a5dd13870b.png">

**Additional context**
Here is the config from our Github Action configuration:

```
- uses: 8398a7/action-slack@v3
  with:
    icon_emoji: ':octocat:'
    status: ${{ job.status }}
    fields: repo,author,eventName,workflow,job
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_CHANNEL_WEBHOOK }}
  if: always() # Pick up events even if the job fails or is canceled.

```


Pull request:
Issue/108
close #108

Patch:
diff --git a/action.yml b/action.yml
index f00ab6d..208b5c5 100644
--- a/action.yml
+++ b/action.yml
@@ -54,6 +54,10 @@ inputs:
     description: override the legacy integration's default channel. This should be an ID, such as C8UJ12P4P.
     default: ""
     required: false
+  job_name:
+    description: Use this if you want to overwrite the job name.
+    default: ""
+    required: false
 runs:
   using: node12
   main: dist/index.js
diff --git a/docs/content/with.md b/docs/content/with.md
index 5a576f7..45cbcfe 100644
--- a/docs/content/with.md
+++ b/docs/content/with.md
@@ -21,6 +21,7 @@ This page describes the elements that can be specified in with.
 | [icon_url](/with#icon_url)             | icon image URL string to use in place of the default icon.                                                                                                                                           | `''`                    |
 | [channel](/with#channel)               | Override the legacy integration's default channel. This should be an ID, such as `C8UJ12P4P`.                                                                                                        | `''`                    |
 | [custom_payload](/with#custom_payload) | e.g. `{"text": "Custom Field Check", obj: 'LOWER CASE'.toLowerCase()}`                                                                                                                               | `''`                    |
+| [job_name](/with#job_name)             | If you want to overwrite the job name, you must specify it.                                                                                                                                          | `''`                    |
 
 # status
 
@@ -193,3 +194,25 @@ See here for `custom_payload` reference.
 - [Message Formatting](https://api.slack.com/docs/messages/builder)
   - Enter json and check in preview.
 - [Reference: Message payloads](https://api.slack.com/reference/messaging/payload)
+
+# job_name
+
+In the action-slack, there are arguments to get the information about the job.  
+They are retrieved from the job name and will not work if the job name is overwritten.
+
+If you want to rename a job and get information about it, give the job a `job_name`.
+
+```yaml
+jobs:
+  test:
+    name: Test
+    runs-on: ubuntu-latest
+    steps:
+      - uses: 8398a7/action-slack@v3
+        with:
+          job_name: Test # Match the name above.
+          fields: job,took
+        env:
+          GITHUB_TOKEN: ${{ github.token }} # optional
+          SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
+```
diff --git a/src/client.ts b/src/client.ts
index e42a85e..eff9673 100644
--- a/src/client.ts
+++ b/src/client.ts
@@ -26,6 +26,7 @@ export interface With {
   icon_url: string;
   channel: string;
   fields: string;
+  job_name: string;
 }
 
 export interface Field {
@@ -63,14 +64,15 @@ export class Client {
   }
 
   private get jobName() {
+    const name = this.with.job_name === '' ? context.job : this.with.job_name;
     if (
       process.env.MATRIX_CONTEXT == null ||
       process.env.MATRIX_CONTEXT === 'null'
     )
-      return context.job;
+      return name;
     const matrix = JSON.parse(process.env.MATRIX_CONTEXT);
     const value = Object.values(matrix).join(', ');
-    return value !== '' ? `${context.job} (${value})` : context.job;
+    return value !== '' ? `${name} (${value})` : name;
   }
 
   async custom(payload: string) {
diff --git a/src/fields.ts b/src/fields.ts
index d76d4e8..04b5105 100644
--- a/src/fields.ts
+++ b/src/fields.ts
@@ -224,7 +224,7 @@ export class FieldFactory {
   }
 
   private get jobIsNotFound() {
-    return 'Job is not found.\nCheck the matrix.';
+    return 'Job is not found.\nCheck <https://action-slack.netlify.app/fields|the matrix> or <https://action-slack.netlify.app/with#job_name|job name>.';
   }
 }
 
diff --git a/src/main.ts b/src/main.ts
index 432ea35..2132784 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -15,6 +15,7 @@ async function run(): Promise<void> {
     const custom_payload = core.getInput('custom_payload');
     const payload = core.getInput('payload');
     const fields = core.getInput('fields');
+    const job_name = core.getInput('job_name');
 
     core.debug(`status: ${status}`);
     core.debug(`mention: ${mention}`);
@@ -28,6 +29,7 @@ async function run(): Promise<void> {
     core.debug(`custom_payload: ${custom_payload}`);
     core.debug(`payload: ${payload}`);
     core.debug(`fields: ${fields}`);
+    core.debug(`job_name: ${job_name}`);
 
     const client = new Client(
       {
@@ -40,6 +42,7 @@ async function run(): Promise<void> {
         icon_url,
         channel,
         fields,
+        job_name,
       },
       process.env.GITHUB_TOKEN,
       process.env.SLACK_WEBHOOK_URL,


Test patch:
diff --git a/__tests__/client.test.ts b/__tests__/client.test.ts
index 6c89dc9..57a4754 100644
--- a/__tests__/client.test.ts
+++ b/__tests__/client.test.ts
@@ -7,6 +7,7 @@ import {
   cancelMsg,
   getTemplate,
   getApiFixture,
+  newWith,
 } from './helper';
 
 import {
@@ -38,15 +39,9 @@ describe('8398a7/action-slack', () => {
 
   describe('fields', () => {
     it('is full fields', async () => {
-      const withParams: With = {
+      const withParams = {
+        ...newWith(),
         status: Success,
-        mention: '',
-        author_name: '',
-        if_mention: '',
-        username: '',
-        icon_emoji: '',
-        icon_url: '',
-        channel: '',
         fields:
           'repo,message,commit,author,job,action,eventName,ref,workflow,took',
       };
@@ -59,16 +54,9 @@ describe('8398a7/action-slack', () => {
 
   describe('text is not specified', () => {
     it('is success', async () => {
-      const withParams: With = {
+      const withParams = {
+        ...newWith(),
         status: Success,
-        mention: '',
-        author_name: '',
-        if_mention: '',
-        username: '',
-        icon_emoji: '',
-        icon_url: '',
-        channel: '',
-        fields: '',
       };
       const client = new Client(withParams, process.env.GITHUB_TOKEN, '');
       const payload = getTemplate(withParams.fields, successMsg);
@@ -76,16 +64,9 @@ describe('8398a7/action-slack', () => {
       expect(await client.prepare('')).toStrictEqual(payload);
     });
     it('is failure', async () => {
-      const withParams: With = {
+      const withParams = {
+        ...newWith(),
         status: Failure,
-        mention: '',
-        author_name: '',
-        if_mention: '',
-        username: '',
-        icon_emoji: '',
-        icon_url: '',
-        channel: '',
-        fields: '',
       };
       const client = new Client(withParams, process.env.GITHUB_TOKEN, '');
       const payload = getTemplate(withParams.fields, failMsg);
@@ -93,16 +74,9 @@ describe('8398a7/action-slack', () => {
       expect(await client.prepare('')).toStrictEqual(payload);
     });
     it('is cancel', async () => {
-      const withParams: With = {
+      const withParams = {
+        ...newWith(),
         status: Cancelled,
-        mention: '',
-        author_name: '',
-        if_mention: '',
-        username: '',
-        icon_emoji: '',
-        icon_url: '',
-        channel: '',
-        fields: '',
       };
       const client = new Client(withParams, process.env.GITHUB_TOKEN, '');
       const payload = getTemplate(withParams.fields, cancelMsg);
@@ -112,16 +86,9 @@ describe('8398a7/action-slack', () => {
   });
 
   it('has no mention', async () => {
-    const withParams: With = {
+    const withParams = {
+      ...newWith(),
       status: Success,
-      mention: '',
-      author_name: '',
-      if_mention: '',
-      username: '',
-      icon_emoji: '',
-      icon_url: '',
-      channel: '',
-      fields: '',
     };
     const client = new Client(withParams, process.env.GITHUB_TOKEN, '');
     const msg = 'mention test';
@@ -131,16 +98,11 @@ describe('8398a7/action-slack', () => {
   });
 
   it('does not match the requirements of the mention', async () => {
-    const withParams: With = {
+    const withParams = {
+      ...newWith(),
       status: Success,
       mention: 'here',
-      author_name: '',
       if_mention: Failure,
-      username: '',
-      icon_emoji: '',
-      icon_url: '',
-      channel: '',
-      fields: '',
     };
     let client = new Client(withParams, process.env.GITHUB_TOKEN, '');
     const msg = 'mention test';
@@ -157,16 +119,11 @@ describe('8398a7/action-slack', () => {
   });
 
   it('matches some of the conditions of the mention', async () => {
-    const withParams: With = {
+    const withParams = {
+      ...newWith(),
       status: Success,
       mention: 'here',
-      author_name: '',
       if_mention: `${Failure},${Success}`,
-      username: '',
-      icon_emoji: '',
-      icon_url: '',
-      channel: '',
-      fields: '',
     };
     const client = new Client(withParams, process.env.GITHUB_TOKEN, '');
     const msg = 'mention test';
@@ -176,16 +133,11 @@ describe('8398a7/action-slack', () => {
   });
 
   it('can be mentioned on success', async () => {
-    const withParams: With = {
+    const withParams = {
+      ...newWith(),
       status: Success,
       mention: 'here',
-      author_name: '',
       if_mention: Success,
-      username: '',
-      icon_emoji: '',
-      icon_url: '',
-      channel: '',
-      fields: '',
     };
     const client = new Client(withParams, process.env.GITHUB_TOKEN, '');
     const msg = 'mention test';
@@ -195,16 +147,11 @@ describe('8398a7/action-slack', () => {
   });
 
   it('can be mentioned on failure', async () => {
-    const withParams: With = {
+    const withParams = {
+      ...newWith(),
       status: Failure,
       mention: 'here',
-      author_name: '',
       if_mention: Failure,
-      username: '',
-      icon_emoji: '',
-      icon_url: '',
-      channel: '',
-      fields: '',
     };
     const client = new Client(withParams, process.env.GITHUB_TOKEN, '');
     const msg = 'mention test';
@@ -214,16 +161,11 @@ describe('8398a7/action-slack', () => {
   });
 
   it('can be mentioned on cancelled', async () => {
-    const withParams: With = {
+    const withParams = {
+      ...newWith(),
       status: Cancelled,
       mention: 'here',
-      author_name: '',
       if_mention: Cancelled,
-      username: '',
-      icon_emoji: '',
-      icon_url: '',
-      channel: '',
-      fields: '',
     };
     const client = new Client(withParams, process.env.GITHUB_TOKEN, '');
     const msg = 'mention test';
@@ -233,16 +175,11 @@ describe('8398a7/action-slack', () => {
   });
 
   it('can be mentioned on always', async () => {
-    const withParams: With = {
+    const withParams = {
+      ...newWith(),
       status: Success,
       mention: 'here',
-      author_name: '',
       if_mention: Always,
-      username: '',
-      icon_emoji: '',
-      icon_url: '',
-      channel: '',
-      fields: '',
     };
     let client = new Client(withParams, process.env.GITHUB_TOKEN, '');
     const msg = 'mention test';
@@ -265,15 +202,10 @@ describe('8398a7/action-slack', () => {
 
   it('mentions one user', async () => {
     const withParams: With = {
+      ...newWith(),
       status: Success,
       mention: 'user_id',
-      author_name: '',
       if_mention: Success,
-      username: '',
-      icon_emoji: '',
-      icon_url: '',
-      channel: '',
-      fields: '',
     };
     const client = new Client(withParams, process.env.GITHUB_TOKEN, '');
     const msg = 'mention test';
@@ -284,15 +216,10 @@ describe('8398a7/action-slack', () => {
 
   it('can be mentioned here', async () => {
     const withParams: With = {
+      ...newWith(),
       status: Success,
       mention: 'here',
-      author_name: '',
       if_mention: Success,
-      username: '',
-      icon_emoji: '',
-      icon_url: '',
-      channel: '',
-      fields: '',
     };
     const client = new Client(withParams, process.env.GITHUB_TOKEN, '');
     const msg = 'mention test';
@@ -303,15 +230,10 @@ describe('8398a7/action-slack', () => {
 
   it('can be mentioned channel', async () => {
     const withParams: With = {
+      ...newWith(),
       status: Success,
       mention: 'channel',
-      author_name: '',
       if_mention: Success,
-      username: '',
-      icon_emoji: '',
-      icon_url: '',
-      channel: '',
-      fields: '',
     };
     const client = new Client(withParams, process.env.GITHUB_TOKEN, '');
     const msg = 'mention test';
@@ -322,15 +244,10 @@ describe('8398a7/action-slack', () => {
 
   it('mentions a user group', async () => {
     const withParams: With = {
+      ...newWith(),
       status: Success,
       mention: 'subteam^user_group_id',
-      author_name: '',
       if_mention: Success,
-      username: '',
-      icon_emoji: '',
-      icon_url: '',
-      channel: '',
-      fields: '',
     };
     const client = new Client(withParams, process.env.GITHUB_TOKEN, '');
     const msg = 'mention test';
@@ -344,15 +261,10 @@ describe('8398a7/action-slack', () => {
 
   it('mentions multiple user groups', async () => {
     const withParams: With = {
+      ...newWith(),
       status: Success,
       mention: 'subteam^user_group_id,subteam^user_group_id2',
-      author_name: '',
       if_mention: Success,
-      username: '',
-      icon_emoji: '',
-      icon_url: '',
-      channel: '',
-      fields: '',
     };
     const client = new Client(withParams, process.env.GITHUB_TOKEN, '');
     const msg = 'mention test';
@@ -366,15 +278,10 @@ describe('8398a7/action-slack', () => {
 
   it('mentions multiple users', async () => {
     const withParams: With = {
+      ...newWith(),
       status: Success,
       mention: 'user_id,user_id2',
-      author_name: '',
       if_mention: Success,
-      username: '',
-      icon_emoji: '',
-      icon_url: '',
-      channel: '',
-      fields: '',
     };
     const client = new Client(withParams, process.env.GITHUB_TOKEN, '');
     const msg = 'mention test';
@@ -388,15 +295,10 @@ describe('8398a7/action-slack', () => {
 
   it('mentions mix of user and user group', async () => {
     const withParams: With = {
+      ...newWith(),
       status: Success,
       mention: 'user_id,subteam^user_group_id',
-      author_name: '',
       if_mention: Success,
-      username: '',
-      icon_emoji: '',
-      icon_url: '',
-      channel: '',
-      fields: '',
     };
     const client = new Client(withParams, process.env.GITHUB_TOKEN, '');
     const msg = 'mention test';
@@ -410,15 +312,10 @@ describe('8398a7/action-slack', () => {
 
   it('removes csv space', async () => {
     const withParams: With = {
+      ...newWith(),
       status: Success,
       mention: 'user_id, user_id2',
-      author_name: '',
       if_mention: Success,
-      username: '',
-      icon_emoji: '',
-      icon_url: '',
-      channel: '',
-      fields: '',
     };
     let client = new Client(withParams, process.env.GITHUB_TOKEN, '');
     const msg = 'hello';
@@ -433,15 +330,8 @@ describe('8398a7/action-slack', () => {
 
   it('returns the expected template', async () => {
     const withParams: With = {
+      ...newWith(),
       status: Success,
-      mention: '',
-      author_name: '',
-      if_mention: '',
-      username: '',
-      icon_emoji: '',
-      icon_url: '',
-      channel: '',
-      fields: '',
     };
     let client = new Client(withParams, process.env.GITHUB_TOKEN, '');
     const msg = 'hello';
@@ -468,14 +358,8 @@ describe('8398a7/action-slack', () => {
 
   it('works without GITHUB_TOKEN', async () => {
     const withParams: With = {
+      ...newWith(),
       status: Success,
-      mention: '',
-      author_name: '',
-      if_mention: '',
-      username: '',
-      icon_emoji: '',
-      icon_url: '',
-      channel: '',
       fields: 'message,author,job,took',
     };
     const client = new Client(withParams, undefined, '');
@@ -490,17 +374,7 @@ describe('8398a7/action-slack', () => {
     expect(await client.prepare('')).toStrictEqual(payload);
   });
   it('throws error', () => {
-    const withParams: With = {
-      status: '',
-      mention: '',
-      author_name: '',
-      if_mention: '',
-      username: '',
-      icon_emoji: '',
-      icon_url: '',
-      channel: '',
-      fields: '',
-    };
+    const withParams = newWith();
     expect(() => new Client(withParams, undefined)).toThrow(
       'Specify secrets.SLACK_WEBHOOK_URL',
     );
@@ -519,17 +393,7 @@ describe('8398a7/action-slack', () => {
       })
       .reply(200, () => getApiFixture('repos.commits.get'));
 
-    const withParams: With = {
-      status: '',
-      mention: '',
-      author_name: '',
-      if_mention: '',
-      username: '',
-      icon_emoji: '',
-      icon_url: '',
-      channel: '',
-      fields: '',
-    };
+    const withParams = newWith();
     const client = new Client(withParams, undefined, mockSlackWebhookUrl);
 
     await client.send('payload');
@@ -538,15 +402,9 @@ describe('8398a7/action-slack', () => {
   });
   describe('.custom', () => {
     it('is full fields', async () => {
-      const withParams: With = {
+      const withParams = {
+        ...newWith(),
         status: 'custom',
-        mention: '',
-        author_name: '',
-        if_mention: '',
-        username: '',
-        icon_emoji: '',
-        icon_url: '',
-        channel: '',
         fields: 'all',
       };
       const client = new Client(withParams, process.env.GITHUB_TOKEN, '');
@@ -563,16 +421,9 @@ describe('8398a7/action-slack', () => {
   });
   describe('#injectColor', () => {
     it('returns an exception that it is an unusual status', () => {
-      const withParams: With = {
+      const withParams = {
+        ...newWith(),
         status: 'custom',
-        mention: '',
-        author_name: '',
-        if_mention: '',
-        username: '',
-        icon_emoji: '',
-        icon_url: '',
-        channel: '',
-        fields: '',
       };
       const client = new Client(withParams, process.env.GITHUB_TOKEN, '');
       expect(() => client.injectColor()).toThrow();
@@ -580,16 +431,9 @@ describe('8398a7/action-slack', () => {
   });
   describe('#injectText', () => {
     it('returns an exception that it is an unusual status', () => {
-      const withParams: With = {
+      const withParams = {
+        ...newWith(),
         status: 'custom',
-        mention: '',
-        author_name: '',
-        if_mention: '',
-        username: '',
-        icon_emoji: '',
-        icon_url: '',
-        channel: '',
-        fields: '',
       };
       const client = new Client(withParams, process.env.GITHUB_TOKEN, '');
       expect(() => client.injectText('')).toThrow();
@@ -597,16 +441,11 @@ describe('8398a7/action-slack', () => {
   });
   describe('mentionText', () => {
     it('returns proper user and group mentions', () => {
-      const withParams: With = {
+      const withParams = {
+        ...newWith(),
         status: Success,
         mention: 'test1,test2, here',
-        author_name: '',
         if_mention: Success,
-        username: '',
-        icon_emoji: '',
-        icon_url: '',
-        channel: '',
-        fields: '',
       };
       const client = new Client(withParams, process.env.GITHUB_TOKEN, '');
       expect(client.mentionText(Success)).toStrictEqual(
diff --git a/__tests__/customJobName.test.ts b/__tests__/customJobName.test.ts
new file mode 100644
index 0000000..211421d
--- /dev/null
+++ b/__tests__/customJobName.test.ts
@@ -0,0 +1,61 @@
+import nock from 'nock';
+
+process.env.GITHUB_RUN_ID = '2';
+process.env.MATRIX_CONTEXT = '{"os": "ubuntu-18.04"}';
+
+import { newWith, setupNockCommit, setupNockJobs, successMsg } from './helper';
+import { Client, With, Success } from '../src/client';
+
+beforeAll(() => {
+  nock.disableNetConnect();
+  setupNockCommit(process.env.GITHUB_SHA as string);
+  setupNockJobs(
+    process.env.GITHUB_RUN_ID as string,
+    'actions.custom-job-name.jobs',
+  );
+});
+afterAll(() => {
+  nock.cleanAll();
+  nock.enableNetConnect();
+});
+
+describe('job_name', () => {
+  beforeEach(() => {
+    process.env.GITHUB_REPOSITORY = '8398a7/action-slack';
+    process.env.GITHUB_EVENT_NAME = 'push';
+    const github = require('@actions/github');
+    github.context.payload = {};
+  });
+
+  it('works even if you rename the job', async () => {
+    const withParams: With = {
+      ...newWith(),
+      status: Success,
+      fields: 'job,took',
+      job_name: 'Custom Job',
+    };
+    const client = new Client(withParams, process.env.GITHUB_TOKEN, '');
+    expect(await client.prepare('')).toStrictEqual({
+      text: successMsg,
+      attachments: [
+        {
+          author_name: '',
+          color: 'good',
+          fields: [
+            {
+              short: true,
+              title: 'job',
+              value:
+                '<https://github.com/8398a7/action-slack/runs/762195612|Custom Job (ubuntu-18.04)>',
+            },
+            { short: true, title: 'took', value: '1 hour 1 min 1 sec' },
+          ],
+        },
+      ],
+      username: '',
+      icon_emoji: '',
+      icon_url: '',
+      channel: '',
+    });
+  });
+});
diff --git a/__tests__/fixtures/actions.custom-job-name.jobs.json b/__tests__/fixtures/actions.custom-job-name.jobs.json
new file mode 100644
index 0000000..7b73380
--- /dev/null
+++ b/__tests__/fixtures/actions.custom-job-name.jobs.json
@@ -0,0 +1,30 @@
+{
+  "total_count": 1,
+  "jobs": [
+    {
+      "id": 762195612,
+      "run_id": 132308092,
+      "run_url": "https://api.github.com/repos/8398a7/action-slack/actions/runs/132308092",
+      "node_id": "MDg6Q2hlY2tSdW43NjIxOTU2MTI=",
+      "head_sha": "cd15a66fc57d465564195faeb5308a63b4317cde",
+      "url": "https://api.github.com/repos/8398a7/action-slack/actions/jobs/762195612",
+      "html_url": "https://github.com/8398a7/action-slack/runs/762195612",
+      "status": "in_progress",
+      "conclusion": null,
+      "started_at": "2020-06-11T15:05:49Z",
+      "completed_at": null,
+      "name": "Custom Job (ubuntu-18.04)",
+      "steps": [
+        {
+          "name": "Set up job",
+          "status": "in_progress",
+          "conclusion": null,
+          "number": 1,
+          "started_at": "2020-06-11T15:05:49.000Z",
+          "completed_at": null
+        }
+      ],
+      "check_run_url": "https://api.github.com/repos/8398a7/action-slack/check-runs/762195612"
+    }
+  ]
+}
diff --git a/__tests__/helper.ts b/__tests__/helper.ts
index d8b9bc5..c93391d 100644
--- a/__tests__/helper.ts
+++ b/__tests__/helper.ts
@@ -1,7 +1,7 @@
 import nock from 'nock';
 import { readFileSync } from 'fs';
 import { resolve } from 'path';
-import { Field } from '../src/client';
+import { Field, With } from '../src/client';
 import { FieldFactory } from '../src/fields';
 
 export const getTemplate: any = (
@@ -53,6 +53,21 @@ export const getApiFixture = (name: string): any =>
     readFileSync(resolve(__dirname, 'fixtures', `${name}.json`)).toString(),
   );
 
+export const newWith = (): With => {
+  return {
+    status: '',
+    mention: '',
+    author_name: '',
+    if_mention: '',
+    username: '',
+    icon_emoji: '',
+    icon_url: '',
+    channel: '',
+    fields: '',
+    job_name: '',
+  };
+};
+
 export const fixedFields = (fields: string, sha?: string) => {
   const ff = new FieldFactory(fields, process.env.GITHUB_JOB as string);
   return ff.filterField(
diff --git a/__tests__/incorrectMatrix.test.ts b/__tests__/incorrectMatrix.test.ts
index 8787f9c..ac22c98 100644
--- a/__tests__/incorrectMatrix.test.ts
+++ b/__tests__/incorrectMatrix.test.ts
@@ -3,7 +3,7 @@ import nock from 'nock';
 process.env.GITHUB_RUN_ID = '2';
 process.env.MATRIX_CONTEXT = '{}';
 
-import { setupNockCommit, setupNockJobs, successMsg } from './helper';
+import { newWith, setupNockCommit, setupNockJobs, successMsg } from './helper';
 import { Client, With, Success } from '../src/client';
 
 beforeAll(() => {
@@ -28,15 +28,9 @@ describe('MATRIX_CONTEXT', () => {
   });
 
   it('not runs in matrix', async () => {
-    const withParams: With = {
+    const withParams = {
+      ...newWith(),
       status: Success,
-      mention: '',
-      author_name: '',
-      if_mention: '',
-      username: '',
-      icon_emoji: '',
-      icon_url: '',
-      channel: '',
       fields: 'job,took',
     };
     const client = new Client(withParams, process.env.GITHUB_TOKEN, '');
@@ -50,12 +44,14 @@ describe('MATRIX_CONTEXT', () => {
             {
               short: true,
               title: 'job',
-              value: 'Job is not found.\nCheck the matrix.',
+              value:
+                'Job is not found.\nCheck <https://action-slack.netlify.app/fields|the matrix> or <https://action-slack.netlify.app/with#job_name|job name>.',
             },
             {
               short: true,
               title: 'took',
-              value: 'Job is not found.\nCheck the matrix.',
+              value:
+                'Job is not found.\nCheck <https://action-slack.netlify.app/fields|the matrix> or <https://action-slack.netlify.app/with#job_name|job name>.',
             },
           ],
         },
diff --git a/__tests__/matrix.test.ts b/__tests__/matrix.test.ts
index 7a9c03d..549061a 100644
--- a/__tests__/matrix.test.ts
+++ b/__tests__/matrix.test.ts
@@ -3,7 +3,7 @@ import nock from 'nock';
 process.env.GITHUB_RUN_ID = '2';
 process.env.MATRIX_CONTEXT = '{"os": "ubuntu-18.04"}';
 
-import { setupNockCommit, setupNockJobs, successMsg } from './helper';
+import { newWith, setupNockCommit, setupNockJobs, successMsg } from './helper';
 import { Client, With, Success } from '../src/client';
 
 beforeAll(() => {
@@ -29,14 +29,8 @@ describe('MATRIX_CONTEXT', () => {
 
   it('runs in matrix', async () => {
     const withParams: With = {
+      ...newWith(),
       status: Success,
-      mention: '',
-      author_name: '',
-      if_mention: '',
-      username: '',
-      icon_emoji: '',
-      icon_url: '',
-      channel: '',
       fields: 'job,took',
     };
     const client = new Client(withParams, process.env.GITHUB_TOKEN, '');
diff --git a/__tests__/pull_request.test.ts b/__tests__/pull_request.test.ts
index 482a09f..4b4d3a2 100644
--- a/__tests__/pull_request.test.ts
+++ b/__tests__/pull_request.test.ts
@@ -2,7 +2,7 @@ import nock from 'nock';
 
 process.env.GITHUB_EVENT_NAME = 'pull_request';
 
-import { setupNockCommit, getTemplate } from './helper';
+import { setupNockCommit, getTemplate, newWith } from './helper';
 import { Client, With, Success } from '../src/client';
 
 beforeAll(() => {
@@ -26,15 +26,11 @@ describe('pull request event', () => {
     };
     github.context.eventName = 'pull_request';
 
-    const withParams: With = {
+    const withParams = {
+      ...newWith(),
       status: Success,
       mention: 'user_id',
-      author_name: '',
       if_mention: Success,
-      username: '',
-      icon_emoji: '',
-      icon_url: '',
-      channel: '',
       fields: 'action',
     };
     const client = new Client(withParams, process.env.GITHUB_TOKEN, '');