From 474df1c5d0822e47c643134355072b829a6e35e0 Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Tue, 23 Apr 2019 16:07:27 +0200
Subject: [PATCH] docs: masterIssue

Closes #2937
---
 lib/config/definitions.js                     | 27 ++++++++++++++++
 lib/config/validation.js                      |  6 +---
 renovate-schema.json                          | 20 ++++++++++++
 .../__snapshots__/flatten.spec.js.snap        | 32 +++++++++++++++++++
 website/docs/configuration-options.md         | 29 +++++++++++++++++
 5 files changed, 109 insertions(+), 5 deletions(-)

diff --git a/lib/config/definitions.js b/lib/config/definitions.js
index 73947df91a..4ef0165aec 100644
--- a/lib/config/definitions.js
+++ b/lib/config/definitions.js
@@ -166,6 +166,33 @@ const options = [
     default: true,
     admin: true,
   },
+  // Master Issue
+  {
+    name: 'masterIssue',
+    description: 'Whether to create a "Master Issue" within the repository.',
+    type: 'boolean',
+    default: false,
+  },
+  {
+    name: 'masterIssueApproval',
+    description:
+      'Whether updates should require manual approval from within the Master Issue before creation.',
+    type: 'boolean',
+    default: false,
+  },
+  {
+    name: 'masterIssueAutoclose',
+    description:
+      'Set to `true` and Renovate will autoclose the Master Issue if there are no updates.',
+    type: 'boolean',
+    default: false,
+  },
+  {
+    name: 'masterIssueTitle',
+    description: 'Title to use for the Master Issue',
+    type: 'string',
+    default: `Update Dependencies (${appName} Bot)`,
+  },
   // encryption
   {
     name: 'privateKey',
diff --git a/lib/config/validation.js b/lib/config/validation.js
index e542bedba3..186b919ebe 100644
--- a/lib/config/validation.js
+++ b/lib/config/validation.js
@@ -69,12 +69,8 @@ async function validateConfig(config, isPreset, parentPath) {
       'forkToken',
       'repository',
       'vulnerabilityAlertsOnly',
-      'copyLocalLibs', // deprecated - functinoality is now enabled by default
+      'copyLocalLibs', // deprecated - functionality is now enabled by default
       'prBody', // deprecated
-      'masterIssue',
-      'masterIssueTitle',
-      'masterIssueApproval',
-      'masterIssueAutoclose',
     ];
     return ignoredNodes.includes(key);
   }
diff --git a/renovate-schema.json b/renovate-schema.json
index 6a7ed8ac69..af092ef9fb 100644
--- a/renovate-schema.json
+++ b/renovate-schema.json
@@ -101,6 +101,26 @@
       "type": "boolean",
       "default": true
     },
+    "masterIssue": {
+      "description": "Whether to create a \"Master Issue\" within the repository.",
+      "type": "boolean",
+      "default": false
+    },
+    "masterIssueApproval": {
+      "description": "Whether updates should require manual approval from within the Master Issue before creation.",
+      "type": "boolean",
+      "default": false
+    },
+    "masterIssueAutoclose": {
+      "description": "Set to `true` and Renovate will autoclose the Master Issue if there are no updates.",
+      "type": "boolean",
+      "default": false
+    },
+    "masterIssueTitle": {
+      "description": "Title to use for the Master Issue",
+      "type": "string",
+      "default": "Update Dependencies (Renovate Bot)"
+    },
     "privateKey": {
       "description": "Server-side private key",
       "type": "string"
diff --git a/test/workers/repository/updates/__snapshots__/flatten.spec.js.snap b/test/workers/repository/updates/__snapshots__/flatten.spec.js.snap
index 41a9cfc748..4cc6aa994e 100644
--- a/test/workers/repository/updates/__snapshots__/flatten.spec.js.snap
+++ b/test/workers/repository/updates/__snapshots__/flatten.spec.js.snap
@@ -41,6 +41,10 @@ Array [
     "lazyGrouping": true,
     "manager": "npm",
     "managerBranchPrefix": "",
+    "masterIssue": false,
+    "masterIssueApproval": false,
+    "masterIssueAutoclose": false,
+    "masterIssueTitle": "Update Dependencies (Renovate Bot)",
     "newValue": "1.0.0",
     "npmToken": null,
     "npmrc": null,
@@ -144,6 +148,10 @@ Array [
     "lazyGrouping": true,
     "manager": "npm",
     "managerBranchPrefix": "",
+    "masterIssue": false,
+    "masterIssueApproval": false,
+    "masterIssueAutoclose": false,
+    "masterIssueTitle": "Update Dependencies (Renovate Bot)",
     "newValue": "2.0.0",
     "npmToken": null,
     "npmrc": null,
@@ -245,6 +253,10 @@ Array [
     "lazyGrouping": true,
     "manager": "npm",
     "managerBranchPrefix": "",
+    "masterIssue": false,
+    "masterIssueApproval": false,
+    "masterIssueAutoclose": false,
+    "masterIssueTitle": "Update Dependencies (Renovate Bot)",
     "npmToken": null,
     "npmrc": null,
     "packageFile": "package.json",
@@ -350,6 +362,10 @@ Array [
     "lazyGrouping": true,
     "manager": "npm",
     "managerBranchPrefix": "",
+    "masterIssue": false,
+    "masterIssueApproval": false,
+    "masterIssueAutoclose": false,
+    "masterIssueTitle": "Update Dependencies (Renovate Bot)",
     "newValue": "3.0.0",
     "npmToken": null,
     "npmrc": null,
@@ -451,6 +467,10 @@ Array [
     "lazyGrouping": true,
     "manager": "npm",
     "managerBranchPrefix": "",
+    "masterIssue": false,
+    "masterIssueApproval": false,
+    "masterIssueAutoclose": false,
+    "masterIssueTitle": "Update Dependencies (Renovate Bot)",
     "npmToken": null,
     "npmrc": null,
     "packageFile": "backend/package.json",
@@ -556,6 +576,10 @@ Array [
     "lazyGrouping": true,
     "manager": "npm",
     "managerBranchPrefix": "",
+    "masterIssue": false,
+    "masterIssueApproval": false,
+    "masterIssueAutoclose": false,
+    "masterIssueTitle": "Update Dependencies (Renovate Bot)",
     "newValue": "3.0.1",
     "npmToken": null,
     "npmrc": null,
@@ -659,6 +683,10 @@ Array [
     "lazyGrouping": true,
     "manager": "dockerfile",
     "managerBranchPrefix": "",
+    "masterIssue": false,
+    "masterIssueApproval": false,
+    "masterIssueAutoclose": false,
+    "masterIssueTitle": "Update Dependencies (Renovate Bot)",
     "newValue": "10.0.1",
     "npmToken": null,
     "npmrc": null,
@@ -762,6 +790,10 @@ Array [
     "lazyGrouping": true,
     "manager": "dockerfile",
     "managerBranchPrefix": "docker-",
+    "masterIssue": false,
+    "masterIssueApproval": false,
+    "masterIssueAutoclose": false,
+    "masterIssueTitle": "Update Dependencies (Renovate Bot)",
     "newValue": "3.2.0",
     "npmToken": null,
     "npmrc": null,
diff --git a/website/docs/configuration-options.md b/website/docs/configuration-options.md
index 24ea501192..33d374c63a 100644
--- a/website/docs/configuration-options.md
+++ b/website/docs/configuration-options.md
@@ -434,6 +434,35 @@ Add to this object if you wish to define rules that apply only to major updates.
 
 This value defaults to empty string, as historically no prefix was necessary for when Renovate was JS-only. Now - for example - we use `docker-` for Docker branches, so they may look like `renovate/docker-ubuntu-16.x`.
 
+## masterIssue
+
+Configuration `masterIssue` to `true` will lead to the creation of a "Master Issue" within the repository. This Master Issue is akin to a mini dashboard and contains a list of all PRs pending, open, closed (unmerged) or in error.
+
+Examples of what having a master issue will allow you to do:
+
+- View all PRs in one place, rather than having to filter PRs by author
+- Rebase/retry multiple PRs without having to open each individually
+- Override any rate limiting (e.g. concurrent PRs) or scheduling to force Renovate to create a PR that would otherwise be suppressed
+- Recreate an unmerged PR (e.g. for a major update that you put off by closing the original PR)
+
+Note: Enabling the Master Issue does not itself change any of the "flow" of Renovate, e.g. it will otherwise still create and manage PRs exactly as it always has. The Master Issue therefore provides visibility as well as additional control.
+
+## masterIssueApproval
+
+Setting `masterIssueApproval` to `true` means that Renovate will no longer create branches/PRs automatically but instead wait for manual approval from within the Master Issue.
+
+In this case, the Master Issue _does_ change the flow of Renovate, because PRs will stop appearing until you approve them within the issue. Instead of enabling this repository-wide, you may instead with to use package rules to enable it selectively, e.g. for major updates only, or for certain package managers, etc. i.e. it is possible to require approval for only certain types of updates only.
+
+Note: Enabling Master Issue Approval implicitly enables `masterIssue` too, so it is not necessary to set both to `true`.
+
+## masterIssueAutoclose
+
+You can set this to `true` if you prefer Renovate to autoclose its Master Issue whenever there are no outstanding PRs left.
+
+## masterIssueTitle
+
+Set this option if you prefer a different title for the Master Issue.
+
 ## maven
 
 ## meteor
-- 
GitLab