From 77a0291d4d6f71da01f2e6c5ec8c782a08ed7cf2 Mon Sep 17 00:00:00 2001
From: Michael Kriese <michael.kriese@visualon.de>
Date: Wed, 25 Sep 2019 12:42:11 +0200
Subject: [PATCH] fix(platform): smart truncate pr body (#4527)

---
 lib/platform/azure/index.ts                   |   3 +-
 lib/platform/bitbucket-server/index.ts        |   6 +-
 lib/platform/bitbucket/index.ts               |   6 +-
 lib/platform/github/index.ts                  |  28 +----
 lib/platform/gitlab/index.ts                  |  12 ++-
 lib/platform/utils/pr-body.ts                 |  23 ++++
 .../utils/__snapshots__/pr-body.spec.ts.snap  |  60 +++++++++++
 test/platform/utils/_fixtures/pr-body.txt     | 101 ++++++++++++++++++
 test/platform/utils/pr-body.spec.ts           |  34 ++++++
 9 files changed, 237 insertions(+), 36 deletions(-)
 create mode 100644 lib/platform/utils/pr-body.ts
 create mode 100644 test/platform/utils/__snapshots__/pr-body.spec.ts.snap
 create mode 100644 test/platform/utils/_fixtures/pr-body.txt
 create mode 100644 test/platform/utils/pr-body.spec.ts

diff --git a/lib/platform/azure/index.ts b/lib/platform/azure/index.ts
index 0d7485f93e..677bb7f05e 100644
--- a/lib/platform/azure/index.ts
+++ b/lib/platform/azure/index.ts
@@ -6,6 +6,7 @@ import GitStorage from '../git/storage';
 import { logger } from '../../logger';
 import { PlatformConfig, RepoParams, RepoConfig } from '../common';
 import { sanitize } from '../../util/sanitize';
+import { smartTruncate } from '../utils/pr-body';
 
 interface Config {
   storage: GitStorage;
@@ -487,7 +488,7 @@ export async function mergePr(pr: number) {
 
 export function getPrBody(input: string) {
   // Remove any HTML we use
-  return input
+  return smartTruncate(input, 4000)
     .replace(new RegExp(`\n---\n\n.*?<!-- ${appSlug}-rebase -->.*?\n`), '')
     .replace('<summary>', '**')
     .replace('</summary>', '**')
diff --git a/lib/platform/bitbucket-server/index.ts b/lib/platform/bitbucket-server/index.ts
index 02db3b56f7..138b3a509b 100644
--- a/lib/platform/bitbucket-server/index.ts
+++ b/lib/platform/bitbucket-server/index.ts
@@ -8,6 +8,7 @@ import GitStorage from '../git/storage';
 import { logger } from '../../logger';
 import { PlatformConfig, RepoParams, RepoConfig } from '../common';
 import { sanitize } from '../../util/sanitize';
+import { smartTruncate } from '../utils/pr-body';
 
 /*
  * Version: 5.3 (EOL Date: 15 Aug 2019)
@@ -952,12 +953,11 @@ export async function mergePr(prNo: number, branchName: string) {
 export function getPrBody(input: string) {
   logger.debug(`getPrBody(${input.split('\n')[0]})`);
   // Remove any HTML we use
-  return input
+  return smartTruncate(input, 30000)
     .replace(/<\/?summary>/g, '**')
     .replace(/<\/?details>/g, '')
     .replace(new RegExp(`\n---\n\n.*?<!-- .*?-rebase -->.*?(\n|$)`), '')
-    .replace(new RegExp('<!--.*?-->', 'g'), '')
-    .substring(0, 30000);
+    .replace(new RegExp('<!--.*?-->', 'g'), '');
 }
 
 export function getCommitMessages() {
diff --git a/lib/platform/bitbucket/index.ts b/lib/platform/bitbucket/index.ts
index f4a1c88692..db3d2908b9 100644
--- a/lib/platform/bitbucket/index.ts
+++ b/lib/platform/bitbucket/index.ts
@@ -10,6 +10,7 @@ import { appSlug } from '../../config/app-strings';
 import * as comments from './comments';
 import { PlatformConfig, RepoParams, RepoConfig } from '../common';
 import { sanitize } from '../../util/sanitize';
+import { smartTruncate } from '../utils/pr-body';
 
 let config: utils.Config = {} as any;
 
@@ -694,12 +695,11 @@ export async function mergePr(prNo: number, branchName: string) {
 
 export function getPrBody(input: string) {
   // Remove any HTML we use
-  return input
+  return smartTruncate(input, 50000)
     .replace(/<\/?summary>/g, '**')
     .replace(/<\/?details>/g, '')
     .replace(new RegExp(`\n---\n\n.*?<!-- ${appSlug}-rebase -->.*?\n`), '')
-    .replace(/\]\(\.\.\/pull\//g, '](../../pull-requests/')
-    .substring(0, 50000);
+    .replace(/\]\(\.\.\/pull\//g, '](../../pull-requests/');
 }
 
 // Return the commit SHA for a branch
diff --git a/lib/platform/github/index.ts b/lib/platform/github/index.ts
index 3b9a7580f3..2baa8a5e01 100644
--- a/lib/platform/github/index.ts
+++ b/lib/platform/github/index.ts
@@ -16,6 +16,7 @@ import {
   urls,
 } from '../../config/app-strings';
 import { sanitize } from '../../util/sanitize';
+import { smartTruncate } from '../utils/pr-body';
 
 const defaultConfigFile = configFileNames[0];
 
@@ -1711,39 +1712,16 @@ export async function mergePr(prNo: number, branchName: string) {
   return true;
 }
 
-// istanbul ignore next
-function smartTruncate(input: string) {
-  if (input.length < 60000) {
-    return input;
-  }
-  const releaseNotesMatch = input.match(
-    new RegExp(`### Release Notes.*### ${appName} configuration`, 'ms')
-  );
-  // istanbul ignore if
-  if (releaseNotesMatch) {
-    const divider = `</details>\n\n---\n\n### ${appName} configuration`;
-    const [releaseNotes] = releaseNotesMatch;
-    const nonReleaseNotesLength =
-      input.length - releaseNotes.length - divider.length;
-    const availableLength = 60000 - nonReleaseNotesLength;
-    return input.replace(
-      releaseNotes,
-      releaseNotes.slice(0, availableLength) + divider
-    );
-  }
-  return input.substring(0, 60000);
-}
-
 export function getPrBody(input: string) {
   if (config.isGhe) {
-    return smartTruncate(input);
+    return smartTruncate(input, 60000);
   }
   const massagedInput = input
     // to be safe, replace all github.com links with renovatebot redirector
     .replace(/href="https?:\/\/github.com\//g, 'href="https://togithub.com/')
     .replace(/]\(https:\/\/github\.com\//g, '](https://togithub.com/')
     .replace(/]: https:\/\/github\.com\//g, ']: https://togithub.com/');
-  return smartTruncate(massagedInput);
+  return smartTruncate(massagedInput, 60000);
 }
 
 export async function getVulnerabilityAlerts() {
diff --git a/lib/platform/gitlab/index.ts b/lib/platform/gitlab/index.ts
index 3e47de1557..b780d0b667 100644
--- a/lib/platform/gitlab/index.ts
+++ b/lib/platform/gitlab/index.ts
@@ -8,6 +8,7 @@ import { PlatformConfig, RepoParams, RepoConfig } from '../common';
 import { configFileNames } from '../../config/app-strings';
 import { logger } from '../../logger';
 import { sanitize } from '../../util/sanitize';
+import { smartTruncate } from '../utils/pr-body';
 
 const defaultConfigFile = configFileNames[0];
 let config: {
@@ -830,10 +831,13 @@ export async function mergePr(iid: number) {
 }
 
 export function getPrBody(input: string) {
-  return input
-    .replace(/Pull Request/g, 'Merge Request')
-    .replace(/PR/g, 'MR')
-    .replace(/\]\(\.\.\/pull\//g, '](../merge_requests/');
+  return smartTruncate(
+    input
+      .replace(/Pull Request/g, 'Merge Request')
+      .replace(/PR/g, 'MR')
+      .replace(/\]\(\.\.\/pull\//g, '](../merge_requests/'),
+    1000000
+  );
 }
 
 export function getCommitMessages() {
diff --git a/lib/platform/utils/pr-body.ts b/lib/platform/utils/pr-body.ts
new file mode 100644
index 0000000000..7158c7b916
--- /dev/null
+++ b/lib/platform/utils/pr-body.ts
@@ -0,0 +1,23 @@
+import { appName } from '../../config/app-strings';
+
+export function smartTruncate(input: string, len: number): string {
+  if (input.length < len) {
+    return input;
+  }
+  const releaseNotesMatch = input.match(
+    new RegExp(`### Release Notes.*### ${appName} configuration`, 'ms')
+  );
+  if (releaseNotesMatch) {
+    const divider = `</details>\n\n---\n\n### ${appName} configuration`;
+    const [releaseNotes] = releaseNotesMatch;
+    const nonReleaseNotesLength =
+      input.length - releaseNotes.length - divider.length;
+    const availableLength = len - nonReleaseNotesLength;
+    if (availableLength <= 0) return input.substring(0, len);
+    return input.replace(
+      releaseNotes,
+      releaseNotes.slice(0, availableLength) + divider
+    );
+  }
+  return input.substring(0, len);
+}
diff --git a/test/platform/utils/__snapshots__/pr-body.spec.ts.snap b/test/platform/utils/__snapshots__/pr-body.spec.ts.snap
new file mode 100644
index 0000000000..e96d6b3a90
--- /dev/null
+++ b/test/platform/utils/__snapshots__/pr-body.spec.ts.snap
@@ -0,0 +1,60 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`platform/utils/pr-body .smartTruncate truncates to 300 not smart 1`] = `
+"This PR contains the following updates:
+
+| Package | Type | Update | Change |
+|---|---|---|---|
+| [renovate/renovate](https://togithub.com/renovatebot/renovate) | final | minor | \`19.46.0-slim\` -> \`19.47.0-slim\` |
+
+---
+
+### Release Notes
+
+<details>
+<summary>renovatebot/renovate</summary>
+
+### [\`v19."
+`;
+
+exports[`platform/utils/pr-body .smartTruncate truncates to 1000 1`] = `
+"This PR contains the following updates:
+
+| Package | Type | Update | Change |
+|---|---|---|---|
+| [renovate/renovate](https://togithub.com/renovatebot/renovate) | final | minor | \`19.46.0-slim\` -> \`19.47.0-slim\` |
+
+---
+
+### Release Notes
+
+<details>
+<summary>renovatebot/renovate</summary>
+
+### [\`v19.47.0\`](https://togithub.com/renovatebot/renovate/releases/19.47.0)
+
+##### Features
+
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togi</details>
+
+---
+
+### Renovate configuration
+
+:date: **Schedule**: At any time (no schedule defined).
+
+:vertical_traffic_light: **Automerge**: Enabled.
+
+:recycle: **Rebasing**: Whenever PR becomes conflicted, or if you modify the PR title to begin with \\"\`rebase!\`\\".
+
+:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.
+
+---
+
+ - [ ] <!-- renovate-rebase -->If you want to rebase/retry this PR, check this box
+
+---
+
+This PR has been generated by [Renovate Bot](https://togithub.com/marketplace/renovate). View repository job log [here](https://renovatebot.com/dashboard#VisualOn/docker-images).
+"
+`;
diff --git a/test/platform/utils/_fixtures/pr-body.txt b/test/platform/utils/_fixtures/pr-body.txt
new file mode 100644
index 0000000000..44c2bdc3e0
--- /dev/null
+++ b/test/platform/utils/_fixtures/pr-body.txt
@@ -0,0 +1,101 @@
+This PR contains the following updates:
+
+| Package | Type | Update | Change |
+|---|---|---|---|
+| [renovate/renovate](https://togithub.com/renovatebot/renovate) | final | minor | `19.46.0-slim` -> `19.47.0-slim` |
+
+---
+
+### Release Notes
+
+<details>
+<summary>renovatebot/renovate</summary>
+
+### [`v19.47.0`](https://togithub.com/renovatebot/renovate/releases/19.47.0)
+
+##### Features
+
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+-   **docker:** AWS ECR authentication support ([#&#8203;4497](https://togithub.com/renovatebot/renovate/issues/4497)) ([acb114a](https://togithub.com/renovatebot/renovate/commit/acb114a))
+
+</details>
+
+---
+
+### Renovate configuration
+
+:date: **Schedule**: At any time (no schedule defined).
+
+:vertical_traffic_light: **Automerge**: Enabled.
+
+:recycle: **Rebasing**: Whenever PR becomes conflicted, or if you modify the PR title to begin with "`rebase!`".
+
+:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.
+
+---
+
+ - [ ] <!-- renovate-rebase -->If you want to rebase/retry this PR, check this box
+
+---
+
+This PR has been generated by [Renovate Bot](https://togithub.com/marketplace/renovate). View repository job log [here](https://renovatebot.com/dashboard#VisualOn/docker-images).
diff --git a/test/platform/utils/pr-body.spec.ts b/test/platform/utils/pr-body.spec.ts
new file mode 100644
index 0000000000..77792e176a
--- /dev/null
+++ b/test/platform/utils/pr-body.spec.ts
@@ -0,0 +1,34 @@
+import fs from 'fs-extra';
+import { smartTruncate } from '../../../lib/platform/utils/pr-body';
+
+describe('platform/utils/pr-body', () => {
+  let prBody: string;
+  beforeAll(async () => {
+    prBody = await fs.readFile(
+      'test/platform/utils/_fixtures/pr-body.txt',
+      'utf8'
+    );
+  });
+  describe('.smartTruncate', () => {
+    it('truncates to 1000', () => {
+      const body = smartTruncate(prBody, 1000);
+      expect(body).toMatchSnapshot();
+      expect(body.length < prBody.length).toEqual(true);
+    });
+
+    it('truncates to 300 not smart', () => {
+      const body = smartTruncate(prBody, 300);
+      expect(body).toMatchSnapshot();
+      expect(body.length).toEqual(300);
+    });
+
+    it('truncates to 10', () => {
+      const body = smartTruncate('Lorem ipsum dolor sit amet', 10);
+      expect(body).toEqual('Lorem ipsu');
+    });
+
+    it('does not truncate', () => {
+      expect(smartTruncate(prBody, 60000)).toEqual(prBody);
+    });
+  });
+});
-- 
GitLab