mirror of
https://github.com/actions/checkout.git
synced 2025-04-19 00:56:45 +00:00
Add option to fetch tags even if fetch-depth > 0 (#579)
* Add option to fetch tags even if fetch-depth > 0 * Add jest tests for fetchDepth and fetchTags options
This commit is contained in:
parent
96f53100ba
commit
7739b9ba2e
10 changed files with 214 additions and 8 deletions
11
dist/index.js
vendored
11
dist/index.js
vendored
|
@ -637,7 +637,7 @@ class GitCommandManager {
|
|||
fetch(refSpec, options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const args = ['-c', 'protocol.version=2', 'fetch'];
|
||||
if (!refSpec.some(x => x === refHelper.tagsRefSpec)) {
|
||||
if (!refSpec.some(x => x === refHelper.tagsRefSpec) && !options.fetchTags) {
|
||||
args.push('--no-tags');
|
||||
}
|
||||
args.push('--prune', '--progress', '--no-recurse-submodules');
|
||||
|
@ -718,8 +718,8 @@ class GitCommandManager {
|
|||
}
|
||||
log1(format) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
var args = format ? ['log', '-1', format] : ['log', '-1'];
|
||||
var silent = format ? false : true;
|
||||
const args = format ? ['log', '-1', format] : ['log', '-1'];
|
||||
const silent = format ? false : true;
|
||||
const output = yield this.execGit(args, false, silent);
|
||||
return output.stdout;
|
||||
});
|
||||
|
@ -1256,6 +1256,7 @@ function getSource(settings) {
|
|||
}
|
||||
else {
|
||||
fetchOptions.fetchDepth = settings.fetchDepth;
|
||||
fetchOptions.fetchTags = settings.fetchTags;
|
||||
const refSpec = refHelper.getRefSpec(settings.ref, settings.commit);
|
||||
yield git.fetch(refSpec, fetchOptions);
|
||||
}
|
||||
|
@ -1734,6 +1735,10 @@ function getInputs() {
|
|||
result.fetchDepth = 0;
|
||||
}
|
||||
core.debug(`fetch depth = ${result.fetchDepth}`);
|
||||
// Fetch tags
|
||||
result.fetchTags =
|
||||
(core.getInput('fetch-tags') || 'false').toUpperCase() === 'TRUE';
|
||||
core.debug(`fetch tags = ${result.fetchTags}`);
|
||||
// LFS
|
||||
result.lfs = (core.getInput('lfs') || 'false').toUpperCase() === 'TRUE';
|
||||
core.debug(`lfs = ${result.lfs}`);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue