Repository: 8398a7/action-slack (ts)

Issue:
Limit commit sha to 8 characters
It's too long to show all of them.

Pull request:
[#59] Limit commit sha to 8 characters
close #59

Patch:
diff --git a/src/client.ts b/src/client.ts
index dc0d423..d68eddd 100644
--- a/src/client.ts
+++ b/src/client.ts
@@ -39,7 +39,6 @@ export class Client {
 
   constructor(props: With, token?: string, webhookUrl?: string) {
     this.with = props;
-    if (this.with.fields === '') this.with.fields = 'repo,commit';
 
     if (token !== undefined) {
       this.github = new github.GitHub(token);
@@ -175,7 +174,10 @@ export class Client {
 
     return {
       title: 'commit',
-      value: `<https://github.com/${owner}/${repo}/commit/${sha}|${sha}>`,
+      value: `<https://github.com/${owner}/${repo}/commit/${sha}|${sha.slice(
+        0,
+        8,
+      )}>`,
       short: true,
     };
   }
diff --git a/src/main.ts b/src/main.ts
index 64cbb02..baa3e94 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -28,7 +28,6 @@ async function run(): Promise<void> {
     core.debug(`channel: ${channel}`);
     core.debug(`custom_payload: ${custom_payload}`);
     core.debug(`payload: ${payload}`);
-    core.debug(`fields: ${fields}`);
 
     const client = new Client(
       {


Test patch:
diff --git a/__tests__/client.test.ts b/__tests__/client.test.ts
index 2e4c276..769b67f 100644
--- a/__tests__/client.test.ts
+++ b/__tests__/client.test.ts
@@ -38,7 +38,9 @@ const commit = (): Field => {
   return {
     short: true,
     title: 'commit',
-    value: `<https://github.com/8398a7/action-slack/commit/${process.env.GITHUB_SHA}|${process.env.GITHUB_SHA}>`,
+    value: `<https://github.com/8398a7/action-slack/commit/${
+      process.env.GITHUB_SHA
+    }|${process.env.GITHUB_SHA?.slice(0, 8)}>`,
   };
 };