From 4a8979e88cd498f4d05daeda5af775a5e6630517 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Marchand?=
 <1673467+uncycler@users.noreply.github.com>
Date: Mon, 4 Jan 2021 21:51:59 +0100
Subject: [PATCH] fix(git-submodule): loop all updated submodules (#8185)

Co-authored-by: Jamie Magee <JamieMagee@users.noreply.github.com>
---
 .../__snapshots__/artifact.spec.ts.snap         | 17 +++++++++++++++++
 lib/manager/git-submodules/artifact.spec.ts     | 10 ++++++++++
 lib/manager/git-submodules/artifacts.ts         | 14 +++++++++-----
 3 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/lib/manager/git-submodules/__snapshots__/artifact.spec.ts.snap b/lib/manager/git-submodules/__snapshots__/artifact.spec.ts.snap
index e1858ffeaf..e501c92774 100644
--- a/lib/manager/git-submodules/__snapshots__/artifact.spec.ts.snap
+++ b/lib/manager/git-submodules/__snapshots__/artifact.spec.ts.snap
@@ -10,3 +10,20 @@ Array [
   },
 ]
 `;
+
+exports[`lib/manager/gitsubmodules/artifacts updateArtifacts() returns two modules 1`] = `
+Array [
+  Object {
+    "file": Object {
+      "contents": "",
+      "name": "renovate",
+    },
+  },
+  Object {
+    "file": Object {
+      "contents": "",
+      "name": "renovate-pro",
+    },
+  },
+]
+`;
diff --git a/lib/manager/git-submodules/artifact.spec.ts b/lib/manager/git-submodules/artifact.spec.ts
index 75c0d66c4b..45113217b6 100644
--- a/lib/manager/git-submodules/artifact.spec.ts
+++ b/lib/manager/git-submodules/artifact.spec.ts
@@ -12,5 +12,15 @@ describe('lib/manager/gitsubmodules/artifacts', () => {
         })
       ).toMatchSnapshot();
     });
+    it('returns two modules', () => {
+      expect(
+        updateArtifacts({
+          packageFileName: '',
+          updatedDeps: ['renovate', 'renovate-pro'],
+          newPackageFileContent: '',
+          config: {},
+        })
+      ).toMatchSnapshot();
+    });
   });
 });
diff --git a/lib/manager/git-submodules/artifacts.ts b/lib/manager/git-submodules/artifacts.ts
index cd0f348e3e..2f14fce0da 100644
--- a/lib/manager/git-submodules/artifacts.ts
+++ b/lib/manager/git-submodules/artifacts.ts
@@ -1,14 +1,18 @@
+import { logger } from '../../logger';
 import { UpdateArtifact, UpdateArtifactsResult } from '../common';
 
 export default function updateArtifacts({
   updatedDeps,
 }: UpdateArtifact): UpdateArtifactsResult[] | null {
-  return [
-    {
+  const res: UpdateArtifactsResult[] = [];
+  updatedDeps.forEach((dep) => {
+    logger.info('Updating submodule ' + dep);
+    res.push({
       file: {
-        name: updatedDeps[0],
+        name: dep,
         contents: '',
       },
-    },
-  ];
+    });
+  });
+  return res;
 }
-- 
GitLab