@@ -981,7 +981,7 @@ class GitCommandManager {
981981 yield this.execGit(args);
982982 });
983983 }
984- submoduleUpdate(fetchDepth, recursive) {
984+ submoduleUpdate(fetchDepth, recursive, filter ) {
985985 return __awaiter(this, void 0, void 0, function* () {
986986 const args = ['-c', 'protocol.version=2'];
987987 args.push('submodule', 'update', '--init', '--force');
@@ -991,6 +991,9 @@ class GitCommandManager {
991991 if (recursive) {
992992 args.push('--recursive');
993993 }
994+ if (filter) {
995+ args.push(`--filter=${filter}`);
996+ }
994997 yield this.execGit(args);
995998 });
996999 }
@@ -1521,8 +1524,9 @@ function getSource(settings) {
15211524 fetchOptions.filter = 'blob:none';
15221525 }
15231526 if (settings.fetchDepth <= 0) {
1524- // Fetch all branches and tags
1525- let refSpec = refHelper.getRefSpecForAllHistory(settings.ref, settings.commit);
1527+ let refSpec = settings.singleBranch
1528+ ? refHelper.getRefSpec(settings.ref, settings.commit)
1529+ : refHelper.getRefSpecForAllHistory(settings.ref, settings.commit);
15261530 yield git.fetch(refSpec, fetchOptions);
15271531 // When all history is fetched, the ref we're interested in may have moved to a different
15281532 // commit (push or force push). If so, fetch again with a targeted refspec.
@@ -1582,7 +1586,7 @@ function getSource(settings) {
15821586 // Checkout submodules
15831587 core.startGroup('Fetching submodules');
15841588 yield git.submoduleSync(settings.nestedSubmodules);
1585- yield git.submoduleUpdate(settings.fetchDepth, settings.nestedSubmodules);
1589+ yield git.submoduleUpdate(settings.fetchDepth, settings.nestedSubmodules, settings.submodulesFilter );
15861590 yield git.submoduleForeach('git config --local gc.auto 0', settings.nestedSubmodules);
15871591 core.endGroup();
15881592 // Persist credentials
@@ -2005,6 +2009,10 @@ function getInputs() {
20052009 }
20062010 core.debug(`ref = '${result.ref}'`);
20072011 core.debug(`commit = '${result.commit}'`);
2012+ // Single branch
2013+ result.singleBranch =
2014+ (core.getInput('single-branch') || 'false').toUpperCase() === 'TRUE';
2015+ core.debug(`single branch = ${result.singleBranch}`);
20082016 // Clean
20092017 result.clean = (core.getInput('clean') || 'true').toUpperCase() === 'TRUE';
20102018 core.debug(`clean = ${result.clean}`);
@@ -2053,6 +2061,11 @@ function getInputs() {
20532061 }
20542062 core.debug(`submodules = ${result.submodules}`);
20552063 core.debug(`recursive submodules = ${result.nestedSubmodules}`);
2064+ const submodulesFilter = core.getInput('submodules-filter');
2065+ if (submodulesFilter) {
2066+ result.submodulesFilter = submodulesFilter;
2067+ }
2068+ core.debug(`submodules filter = ${result.submodulesFilter}`);
20562069 // Auth token
20572070 result.authToken = core.getInput('token', { required: true });
20582071 // SSH
0 commit comments