diff --git a/index.js b/index.js index 058ca31..eb0c800 100644 --- a/index.js +++ b/index.js @@ -126,14 +126,16 @@ try { const newlineIndex = originalCommitMessage.indexOf('\n'); - // Trim commit message to first line + // Truncate commit message to first line let commitMessage = newlineIndex > -1 ? originalCommitMessage.substring(0, newlineIndex) : originalCommitMessage; - // Trim commit message to 50 characters + // Truncate commit message to 50 characters commitMessage = commitMessage.length >= 50 ? commitMessage.substring(0, 50) + '...' : commitMessage + // Truncate branch name to 33 characters + branchName = env.branch.length >= 33 ? env.branch.substring(0, 33) + '...' : env.branch const details = commitMessage - ? `>${commitMessage}\n>${links.commit} | By *${sender.name}* on \`${env.branch}\`` - : `>By *${sender.name}* on \`${env.branch}\`` + ? `>${commitMessage}\n>${links.commit} | By *${sender.name}* on \`${branchName}\`` + : `>By *${sender.name}* on \`${branchName}\`` if (!process.env.SLACK_WEBHOOK_URL) { core.setFailed('Missing SLACK_WEBHOOK_URL environment variable')