@@ -795,17 +795,32 @@ class GitCommandManager {
795
795
yield this.execGit(args);
796
796
});
797
797
}
798
- submoduleUpdate(fetchDepth, recursive) {
798
+ submoduleUpdate(fetchDepth, recursive, submoduleDirectories ) {
799
799
return __awaiter(this, void 0, void 0, function* () {
800
- const args = ['-c', 'protocol.version=2'];
801
- args.push('submodule', 'update', '--init', '--force');
802
- if (fetchDepth > 0) {
803
- args.push(`--depth=${fetchDepth}`);
800
+ if (submoduleDirectories) {
801
+ for (const submodule of submoduleDirectories) {
802
+ const args = ['-c', 'protocol.version=2'];
803
+ args.push('submodule', 'update', '--init', '--force', submodule);
804
+ if (fetchDepth > 0) {
805
+ args.push(`--depth=${fetchDepth}`);
806
+ }
807
+ if (recursive) {
808
+ args.push('--recursive');
809
+ }
810
+ yield this.execGit(args);
811
+ }
804
812
}
805
- if (recursive) {
806
- args.push('--recursive');
813
+ else {
814
+ const args = ['-c', 'protocol.version=2'];
815
+ args.push('submodule', 'update', '--init', '--force');
816
+ if (fetchDepth > 0) {
817
+ args.push(`--depth=${fetchDepth}`);
818
+ }
819
+ if (recursive) {
820
+ args.push('--recursive');
821
+ }
822
+ yield this.execGit(args);
807
823
}
808
- yield this.execGit(args);
809
824
});
810
825
}
811
826
submoduleStatus() {
@@ -1342,7 +1357,7 @@ function getSource(settings) {
1342
1357
// Checkout submodules
1343
1358
core.startGroup('Fetching submodules');
1344
1359
yield git.submoduleSync(settings.nestedSubmodules);
1345
- yield git.submoduleUpdate(settings.fetchDepth, settings.nestedSubmodules);
1360
+ yield git.submoduleUpdate(settings.fetchDepth, settings.nestedSubmodules, settings.submoduleDirectories );
1346
1361
yield git.submoduleForeach('git config --local gc.auto 0', settings.nestedSubmodules);
1347
1362
core.endGroup();
1348
1363
// Persist credentials
@@ -1805,6 +1820,7 @@ function getInputs() {
1805
1820
// Submodules
1806
1821
result.submodules = false;
1807
1822
result.nestedSubmodules = false;
1823
+ result.submoduleDirectories = null;
1808
1824
const submodulesString = (core.getInput('submodules') || '').toUpperCase();
1809
1825
if (submodulesString == 'RECURSIVE') {
1810
1826
result.submodules = true;
@@ -1813,8 +1829,18 @@ function getInputs() {
1813
1829
else if (submodulesString == 'TRUE') {
1814
1830
result.submodules = true;
1815
1831
}
1832
+ const submoduleDirectories = core.getMultilineInput('submodule-directories');
1833
+ if (submoduleDirectories.length > 0) {
1834
+ result.submoduleDirectories = submoduleDirectories;
1835
+ if (!result.submodules)
1836
+ result.submodules = true;
1837
+ }
1838
+ else {
1839
+ result.submoduleDirectories = null;
1840
+ }
1816
1841
core.debug(`submodules = ${result.submodules}`);
1817
1842
core.debug(`recursive submodules = ${result.nestedSubmodules}`);
1843
+ core.debug(`submodule directories = ${result.submoduleDirectories}`);
1818
1844
// Auth token
1819
1845
result.authToken = core.getInput('token', { required: true });
1820
1846
// SSH
0 commit comments