Skip to content

Commit 9531665

Browse files
committed
Transpile
1 parent 085e46f commit 9531665

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

.github/actions/checkout/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ Please refer to the [release page](https://github.com/actions/checkout/releases/
6363
# Otherwise, uses the default branch.
6464
ref: ''
6565

66+
# Whether to fetch only a single branch from the history. When true, only the
67+
# history leading to the specified ref is fetched. When false, the full history is
68+
# fetched.
69+
# Default: false
70+
single-branch: ''
71+
6672
# Personal access token (PAT) used to fetch the repository. The PAT is configured
6773
# with the local git config, which enables your scripts to run authenticated git
6874
# commands. The post-job step removes the PAT.
@@ -150,6 +156,10 @@ Please refer to the [release page](https://github.com/actions/checkout/releases/
150156
# Default: false
151157
submodules: ''
152158

159+
# Filter to use for submodules.
160+
# Default: null
161+
submodules-filter: ''
162+
153163
# Add repository path as safe.directory for Git global config by running `git
154164
# config --global --add safe.directory <path>`
155165
# Default: true

.github/actions/checkout/dist/index.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)