From 2a40b6db7904dc1c07d109a4fbf42b82793a83de Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Fri, 11 Jun 2021 09:49:09 +0200
Subject: [PATCH] fix(regex): add currentValueTemplate

---
 docs/usage/configuration-options.md | 5 +++++
 lib/config/definitions.ts           | 9 +++++++++
 lib/config/validation.ts            | 1 +
 3 files changed, 15 insertions(+)

diff --git a/docs/usage/configuration-options.md b/docs/usage/configuration-options.md
index 74d236d653..586240b3a8 100644
--- a/docs/usage/configuration-options.md
+++ b/docs/usage/configuration-options.md
@@ -1996,6 +1996,11 @@ It will be compiled using Handlebars and the regex `groups` result.
 It will be compiled using Handlebars and the regex `groups` result.
 It will default to the value of `depName` if left unconfigured/undefined.
 
+### currentValueTemplate
+
+If the `currentValue` for a dependency is not captured with a named group then it can be defined in config using this field.
+It will be compiled using Handlebars and the regex `groups` result.
+
 ### datasourceTemplate
 
 If the `datasource` for a dependency is not captured with a named group then it can be defined in config using this field.
diff --git a/lib/config/definitions.ts b/lib/config/definitions.ts
index 8cff7fab64..e76131de8a 100644
--- a/lib/config/definitions.ts
+++ b/lib/config/definitions.ts
@@ -1929,6 +1929,15 @@ const options: RenovateOptions[] = [
     cli: false,
     env: false,
   },
+  {
+    name: 'currentValueTemplate',
+    description:
+      'Optional currentValue for extracted dependencies. Valid only within a `regexManagers` object.',
+    type: 'string',
+    parent: 'regexManagers',
+    cli: false,
+    env: false,
+  },
   {
     name: 'versioningTemplate',
     description:
diff --git a/lib/config/validation.ts b/lib/config/validation.ts
index 7c0a400bda..b331e7c29c 100644
--- a/lib/config/validation.ts
+++ b/lib/config/validation.ts
@@ -387,6 +387,7 @@ export async function validateConfig(
                 'datasourceTemplate',
                 'versioningTemplate',
                 'registryUrlTemplate',
+                'currentValueTemplate',
               ];
               // TODO: fix types
               for (const regexManager of val as any[]) {
-- 
GitLab