diff --git a/dist/index.js b/dist/index.js index 06ae5d2..37e10ac 100644 --- a/dist/index.js +++ b/dist/index.js @@ -35816,6 +35816,9 @@ class GitCommandManager { const output = await this.execGit(['rev-parse', '--symbolic-full-name', '--verify', '--quiet', 'HEAD'], true); return !output.stdout.trim().startsWith('refs/heads/'); } + async lfsCheckout() { + await this.execGit(['lfs', 'checkout']); + } async lfsFetch(ref) { const args = ['lfs', 'fetch', 'origin', ref]; const that = this; @@ -41879,6 +41882,12 @@ async function getSource(settings) { startGroup('Checking out the ref'); await git.checkout(checkoutInfo.ref, checkoutInfo.startPoint); endGroup(); + // LFS checkout + if (settings.lfs && !settings.sparseCheckout) { + startGroup('Checking out LFS objects'); + await git.lfsCheckout(); + endGroup(); + } // Submodules if (settings.submodules) { // Temporarily override global config diff --git a/src/git-command-manager.ts b/src/git-command-manager.ts index 8431658..51e81fe 100644 --- a/src/git-command-manager.ts +++ b/src/git-command-manager.ts @@ -45,6 +45,7 @@ export interface IGitCommandManager { getWorkingDirectory(): string init(objectFormat?: string): Promise isDetached(): Promise + lfsCheckout(): Promise lfsFetch(ref: string): Promise lfsInstall(): Promise log1(format?: string): Promise @@ -383,6 +384,10 @@ class GitCommandManager { return !output.stdout.trim().startsWith('refs/heads/') } + async lfsCheckout(): Promise { + await this.execGit(['lfs', 'checkout']) + } + async lfsFetch(ref: string): Promise { const args = ['lfs', 'fetch', 'origin', ref] diff --git a/src/git-source-provider.ts b/src/git-source-provider.ts index b9c1d35..af37f43 100644 --- a/src/git-source-provider.ts +++ b/src/git-source-provider.ts @@ -271,6 +271,13 @@ export async function getSource(settings: IGitSourceSettings): Promise { await git.checkout(checkoutInfo.ref, checkoutInfo.startPoint) core.endGroup() + // LFS checkout + if (settings.lfs && !settings.sparseCheckout) { + core.startGroup('Checking out LFS objects') + await git.lfsCheckout() + core.endGroup() + } + // Submodules if (settings.submodules) { // Temporarily override global config