From e6ebf1dc16a78872a2b30cbf11c33dd20d84e71f Mon Sep 17 00:00:00 2001
From: Johannes Feichtner <343448+Churro@users.noreply.github.com>
Date: Tue, 7 Feb 2023 05:59:04 +0100
Subject: [PATCH] feat(manager/mix): set currentVersion field for exact
 dependency versions (#20260)

---
 lib/modules/manager/mix/__fixtures__/mix.exs | 1 +
 lib/modules/manager/mix/extract.spec.ts      | 7 +++++++
 lib/modules/manager/mix/extract.ts           | 3 +++
 3 files changed, 11 insertions(+)

diff --git a/lib/modules/manager/mix/__fixtures__/mix.exs b/lib/modules/manager/mix/__fixtures__/mix.exs
index fe1c24b7c7..3bb83fc5d2 100644
--- a/lib/modules/manager/mix/__fixtures__/mix.exs
+++ b/lib/modules/manager/mix/__fixtures__/mix.exs
@@ -30,6 +30,7 @@ defmodule MyProject.MixProject do
       {:jason, ">= 1.0.0"},
       {:jason, "~> 1.0",
         optional: true},
+      {:phoenix, "== 1.6.14"},
     ]
   end
 end
diff --git a/lib/modules/manager/mix/extract.spec.ts b/lib/modules/manager/mix/extract.spec.ts
index 3ccc432018..3703f2f487 100644
--- a/lib/modules/manager/mix/extract.spec.ts
+++ b/lib/modules/manager/mix/extract.spec.ts
@@ -79,6 +79,13 @@ describe('modules/manager/mix/extract', () => {
           depName: 'jason',
           packageName: 'jason',
         },
+        {
+          currentValue: '== 1.6.14',
+          currentVersion: '1.6.14',
+          datasource: 'hex',
+          depName: 'phoenix',
+          packageName: 'phoenix',
+        },
       ]);
     });
   });
diff --git a/lib/modules/manager/mix/extract.ts b/lib/modules/manager/mix/extract.ts
index 54bd5e5717..3d4f58f8a9 100644
--- a/lib/modules/manager/mix/extract.ts
+++ b/lib/modules/manager/mix/extract.ts
@@ -59,6 +59,9 @@ export async function extractPackageFile(
             datasource: HexDatasource.id,
             packageName: organization ? `${app}:${organization}` : app,
           };
+          if (requirement?.startsWith('==')) {
+            dep.currentVersion = requirement.replace(regEx(/^==\s*/), '');
+          }
         }
 
         deps.push(dep);
-- 
GitLab