From 709a68c7ae8b65614c92d4c6c7db2c1c3e7b3c3b Mon Sep 17 00:00:00 2001
From: Ed Morley <501702+edmorley@users.noreply.github.com>
Date: Wed, 20 Dec 2017 05:47:20 +0000
Subject: [PATCH] fix: increase prNotPendingHours default to 24 hours (#1316)

To prevent PRs being opened prior to the `unpublishSafe` check having
transitioned from `pending` to `success`, when using `not-pending`
mode.

Fixes #1312.
---
 docs/configuration.md                              |  2 +-
 lib/config/definitions.js                          |  3 ++-
 test/manager/__snapshots__/resolve.spec.js.snap    | 14 +++++++-------
 .../package/__snapshots__/index.spec.js.snap       |  2 +-
 .../updates/__snapshots__/branchify.spec.js.snap   | 10 +++++-----
 5 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/docs/configuration.md b/docs/configuration.md
index 5ccb1fb527..344ff6c7f3 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -609,7 +609,7 @@ location with this method.
   <td>`prNotPendingHours`</td>
   <td>Timeout in hours for when prCreation=not-pending</td>
   <td>integer</td>
-  <td><pre>12</pre></td>
+  <td><pre>24</pre></td>
   <td>`RENOVATE_PR_NOT_PENDING_HOURS`</td>
   <td>`--pr-not-pending-hours`<td>
 </tr>
diff --git a/lib/config/definitions.js b/lib/config/definitions.js
index 1f656c2474..ecd73e3a5d 100644
--- a/lib/config/definitions.js
+++ b/lib/config/definitions.js
@@ -495,7 +495,8 @@ const options = [
     name: 'prNotPendingHours',
     description: 'Timeout in hours for when prCreation=not-pending',
     type: 'integer',
-    default: 12,
+    // Must be at least 24 hours to give time for the unpublishSafe check to "complete".
+    default: 24,
   },
   // Automatic merging
   {
diff --git a/test/manager/__snapshots__/resolve.spec.js.snap b/test/manager/__snapshots__/resolve.spec.js.snap
index e62eb84483..d1ce9c9ba3 100644
--- a/test/manager/__snapshots__/resolve.spec.js.snap
+++ b/test/manager/__snapshots__/resolve.spec.js.snap
@@ -502,7 +502,7 @@ Please make sure the following warnings are safe to ignore:
 
 This PR has been generated by [Renovate Bot](https://renovateapp.com).",
   "prCreation": "immediate",
-  "prNotPendingHours": 12,
+  "prNotPendingHours": 24,
   "prTitle": "{{#if isPin}}Pin{{else}}{{#if isRollback}}Roll back{{else}}Update{{/if}}{{/if}} dependency {{depName}} to {{#if isRange}}{{newVersion}}{{else}}{{#if isMajor}}v{{newVersionMajor}}{{else}}v{{newVersion}}{{/if}}{{/if}}",
   "privateKey": null,
   "rebaseStalePrs": false,
@@ -1040,7 +1040,7 @@ Please make sure the following warnings are safe to ignore:
 
 This PR has been generated by [Renovate Bot](https://renovateapp.com).",
   "prCreation": "immediate",
-  "prNotPendingHours": 12,
+  "prNotPendingHours": 24,
   "prTitle": "{{#if isPin}}Pin{{else}}{{#if isRollback}}Roll back{{else}}Update{{/if}}{{/if}} dependency {{depName}} to {{#if isRange}}{{newVersion}}{{else}}{{#if isMajor}}v{{newVersionMajor}}{{else}}v{{newVersion}}{{/if}}{{/if}}",
   "privateKey": null,
   "rebaseStalePrs": false,
@@ -1834,7 +1834,7 @@ Please make sure the following warnings are safe to ignore:
 
 This PR has been generated by [Renovate Bot](https://renovateapp.com).",
   "prCreation": "immediate",
-  "prNotPendingHours": 12,
+  "prNotPendingHours": 24,
   "prTitle": "{{#if isPin}}Pin{{else}}{{#if isRollback}}Roll back{{else}}Update{{/if}}{{/if}} dependency {{depName}} to {{#if isRange}}{{newVersion}}{{else}}{{#if isMajor}}v{{newVersionMajor}}{{else}}v{{newVersion}}{{/if}}{{/if}}",
   "privateKey": null,
   "rebaseStalePrs": false,
@@ -2367,7 +2367,7 @@ Please make sure the following warnings are safe to ignore:
 
 This PR has been generated by [Renovate Bot](https://renovateapp.com).",
   "prCreation": "immediate",
-  "prNotPendingHours": 12,
+  "prNotPendingHours": 24,
   "prTitle": "{{#if isPin}}Pin{{else}}{{#if isRollback}}Roll back{{else}}Update{{/if}}{{/if}} dependency {{depName}} to {{#if isRange}}{{newVersion}}{{else}}{{#if isMajor}}v{{newVersionMajor}}{{else}}v{{newVersion}}{{/if}}{{/if}}",
   "privateKey": null,
   "rebaseStalePrs": false,
@@ -2891,7 +2891,7 @@ Please make sure the following warnings are safe to ignore:
 
 This PR has been generated by [Renovate Bot](https://renovateapp.com).",
   "prCreation": "immediate",
-  "prNotPendingHours": 12,
+  "prNotPendingHours": 24,
   "prTitle": "{{#if isPin}}Pin{{else}}{{#if isRollback}}Roll back{{else}}Update{{/if}}{{/if}} dependency {{depName}} to {{#if isRange}}{{newVersion}}{{else}}{{#if isMajor}}v{{newVersionMajor}}{{else}}v{{newVersion}}{{/if}}{{/if}}",
   "privateKey": null,
   "rebaseStalePrs": false,
@@ -3415,7 +3415,7 @@ Please make sure the following warnings are safe to ignore:
 
 This PR has been generated by [Renovate Bot](https://renovateapp.com).",
   "prCreation": "immediate",
-  "prNotPendingHours": 12,
+  "prNotPendingHours": 24,
   "prTitle": "{{#if isPin}}Pin{{else}}{{#if isRollback}}Roll back{{else}}Update{{/if}}{{/if}} dependency {{depName}} to {{#if isRange}}{{newVersion}}{{else}}{{#if isMajor}}v{{newVersionMajor}}{{else}}v{{newVersion}}{{/if}}{{/if}}",
   "privateKey": null,
   "rebaseStalePrs": false,
@@ -3948,7 +3948,7 @@ Please make sure the following warnings are safe to ignore:
 
 This PR has been generated by [Renovate Bot](https://renovateapp.com).",
   "prCreation": "immediate",
-  "prNotPendingHours": 12,
+  "prNotPendingHours": 24,
   "prTitle": "{{#if isPin}}Pin{{else}}{{#if isRollback}}Roll back{{else}}Update{{/if}}{{/if}} dependency {{depName}} to {{#if isRange}}{{newVersion}}{{else}}{{#if isMajor}}v{{newVersionMajor}}{{else}}v{{newVersion}}{{/if}}{{/if}}",
   "privateKey": null,
   "rebaseStalePrs": false,
diff --git a/test/workers/package/__snapshots__/index.spec.js.snap b/test/workers/package/__snapshots__/index.spec.js.snap
index 8cb541f640..8008d81210 100644
--- a/test/workers/package/__snapshots__/index.spec.js.snap
+++ b/test/workers/package/__snapshots__/index.spec.js.snap
@@ -139,7 +139,7 @@ Please make sure the following warnings are safe to ignore:
 
 This PR has been generated by [Renovate Bot](https://renovateapp.com).",
   "prCreation": "immediate",
-  "prNotPendingHours": 12,
+  "prNotPendingHours": 24,
   "prTitle": "{{#if isPin}}Pin{{else}}{{#if isRollback}}Roll back{{else}}Update{{/if}}{{/if}} dependency {{depName}} to {{#if isRange}}{{newVersion}}{{else}}{{#if isMajor}}v{{newVersionMajor}}{{else}}v{{newVersion}}{{/if}}{{/if}}",
   "rebaseStalePrs": true,
   "recreateClosed": true,
diff --git a/test/workers/repository/updates/__snapshots__/branchify.spec.js.snap b/test/workers/repository/updates/__snapshots__/branchify.spec.js.snap
index c59cd6f308..f158e8007e 100644
--- a/test/workers/repository/updates/__snapshots__/branchify.spec.js.snap
+++ b/test/workers/repository/updates/__snapshots__/branchify.spec.js.snap
@@ -541,7 +541,7 @@ Please make sure the following warnings are safe to ignore:
 
 This PR has been generated by [Renovate Bot](https://renovateapp.com).",
   "prCreation": "immediate",
-  "prNotPendingHours": 12,
+  "prNotPendingHours": 24,
   "prTitle": "{{#if isPin}}Pin{{else}}{{#if isRollback}}Roll back{{else}}Update{{/if}}{{/if}} dependency {{depName}} to {{#if isRange}}{{newVersion}}{{else}}{{#if isMajor}}v{{newVersionMajor}}{{else}}v{{newVersion}}{{/if}}{{/if}}",
   "privateKey": null,
   "rebaseStalePrs": false,
@@ -1102,7 +1102,7 @@ Please make sure the following warnings are safe to ignore:
 
 This PR has been generated by [Renovate Bot](https://renovateapp.com).",
   "prCreation": "immediate",
-  "prNotPendingHours": 12,
+  "prNotPendingHours": 24,
   "prTitle": "{{#if isPin}}Pin{{else}}{{#if isRollback}}Roll back{{else}}Update{{/if}}{{/if}} dependency {{depName}} to {{#if isRange}}{{newVersion}}{{else}}{{#if isMajor}}v{{newVersionMajor}}{{else}}v{{newVersion}}{{/if}}{{/if}}",
   "privateKey": null,
   "rebaseStalePrs": false,
@@ -1669,7 +1669,7 @@ Please make sure the following warnings are safe to ignore:
 
 This PR has been generated by [Renovate Bot](https://renovateapp.com).",
   "prCreation": "immediate",
-  "prNotPendingHours": 12,
+  "prNotPendingHours": 24,
   "prTitle": "{{#if isPin}}Pin{{else}}{{#if isRollback}}Roll back{{else}}Update{{/if}}{{/if}} dependency {{depName}} to {{#if isRange}}{{newVersion}}{{else}}{{#if isMajor}}v{{newVersionMajor}}{{else}}v{{newVersion}}{{/if}}{{/if}}",
   "privateKey": null,
   "rebaseStalePrs": false,
@@ -2224,7 +2224,7 @@ Please make sure the following warnings are safe to ignore:
 
 This PR has been generated by [Renovate Bot](https://renovateapp.com).",
   "prCreation": "immediate",
-  "prNotPendingHours": 12,
+  "prNotPendingHours": 24,
   "prTitle": "{{#if isPin}}Pin{{else}}{{#if isRollback}}Roll back{{else}}Update{{/if}}{{/if}} dependency {{depName}} to {{#if isRange}}{{newVersion}}{{else}}{{#if isMajor}}v{{newVersionMajor}}{{else}}v{{newVersion}}{{/if}}{{/if}}",
   "privateKey": null,
   "rebaseStalePrs": false,
@@ -2774,7 +2774,7 @@ Please make sure the following warnings are safe to ignore:
 
 This PR has been generated by [Renovate Bot](https://renovateapp.com).",
   "prCreation": "immediate",
-  "prNotPendingHours": 12,
+  "prNotPendingHours": 24,
   "prTitle": "{{#if isPin}}Pin{{else}}{{#if isRollback}}Roll back{{else}}Update{{/if}}{{/if}} dependency {{depName}} to {{#if isRange}}{{newVersion}}{{else}}{{#if isMajor}}v{{newVersionMajor}}{{else}}v{{newVersion}}{{/if}}{{/if}}",
   "privateKey": null,
   "rebaseStalePrs": false,
-- 
GitLab