mirror of
https://code.forgejo.org/actions/checkout.git
synced 2025-04-21 09:10:16 +03:00
Add sparse checkout support
This commit is contained in:
parent
230611dbd0
commit
ad6eac3f6b
11 changed files with 128 additions and 0 deletions
27
dist/index.js
vendored
27
dist/index.js
vendored
|
@ -7076,6 +7076,17 @@ class GitCommandManager {
|
|||
return output.exitCode === 0;
|
||||
});
|
||||
}
|
||||
sparseCheckout(cone, paths) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const args1 = ['sparse-checkout', 'init'];
|
||||
if (cone) {
|
||||
args1.push('--cone');
|
||||
}
|
||||
const args2 = ['sparse-checkout', 'set', '--', ...paths];
|
||||
yield this.execGit(args1);
|
||||
yield this.execGit(args2);
|
||||
});
|
||||
}
|
||||
submoduleForeach(command, recursive) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const args = ['submodule', 'foreach'];
|
||||
|
@ -7409,6 +7420,12 @@ function getSource(settings) {
|
|||
yield git.lfsFetch(checkoutInfo.startPoint || checkoutInfo.ref);
|
||||
core.endGroup();
|
||||
}
|
||||
// Sparse checkout
|
||||
if (settings.sparse) {
|
||||
core.startGroup('Sparse checkout');
|
||||
yield git.sparseCheckout(settings.sparseCone, settings.sparse);
|
||||
core.endGroup();
|
||||
}
|
||||
// Checkout
|
||||
core.startGroup('Checking out the ref');
|
||||
yield git.checkout(checkoutInfo.ref, checkoutInfo.startPoint);
|
||||
|
@ -17219,6 +17236,16 @@ function getInputs() {
|
|||
// LFS
|
||||
result.lfs = (core.getInput('lfs') || 'false').toUpperCase() === 'TRUE';
|
||||
core.debug(`lfs = ${result.lfs}`);
|
||||
if (core.getInput('sparse')) {
|
||||
const paths = core
|
||||
.getInput('sparse')
|
||||
.trim()
|
||||
.split(`\n`)
|
||||
.map(s => s.trim());
|
||||
result.sparse = paths;
|
||||
}
|
||||
result.sparseCone =
|
||||
(core.getInput('sparse-cone') || 'false').toUpperCase() === 'TRUE';
|
||||
// Submodules
|
||||
result.submodules = false;
|
||||
result.nestedSubmodules = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue