1
0
Fork 0
mirror of https://code.forgejo.org/actions/checkout.git synced 2025-08-14 17:30:50 +00:00
This commit is contained in:
parker-michel-vanta 2025-08-11 15:54:42 +02:00 committed by GitHub
commit 982990b71c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 57 additions and 5 deletions

14
dist/index.js vendored
View file

@ -663,6 +663,9 @@ class GitCommandManager {
if (options.filter) {
args.push(`--filter=${options.filter}`);
}
if (options.shallowSince) {
args.push(`--shallow-since=${options.shallowSince}`);
}
if (options.fetchDepth && options.fetchDepth > 0) {
args.push(`--depth=${options.fetchDepth}`);
}
@ -793,13 +796,16 @@ class GitCommandManager {
yield this.execGit(args);
});
}
submoduleUpdate(fetchDepth, recursive) {
submoduleUpdate(fetchDepth, recursive, shallowSince) {
return __awaiter(this, void 0, void 0, function* () {
const args = ['-c', 'protocol.version=2'];
args.push('submodule', 'update', '--init', '--force');
if (fetchDepth > 0) {
args.push(`--depth=${fetchDepth}`);
}
if (shallowSince) {
args.push(`--shallow-since=${shallowSince}`);
}
if (recursive) {
args.push('--recursive');
}
@ -1787,6 +1793,12 @@ function getInputs() {
result.fetchDepth = 0;
}
core.debug(`fetch depth = ${result.fetchDepth}`);
// Shallow since
if (core.getInput('fetch-depth') && core.getInput('shallow-since')) {
throw new Error('`fetch-depth` and `shallow-since` cannot be used at the same time');
}
result.shallowSince = core.getInput('shallow-since');
core.debug(`shallow since = ${result.shallowSince}`);
// Fetch tags
result.fetchTags =
(core.getInput('fetch-tags') || 'false').toUpperCase() === 'TRUE';