mirror of
https://github.com/actions/checkout.git
synced 2025-03-14 10:07:00 +00:00
Add the ability to setup a caching git-lfs proxy server
This commit is contained in:
parent
1f9a0c22da
commit
5262024a96
6 changed files with 2391 additions and 2354 deletions
|
@ -82,6 +82,10 @@ When Git 2.18 or higher is not in your PATH, falls back to the REST API to downl
|
|||
# Default: false
|
||||
lfs: ''
|
||||
|
||||
# URL to use when fetching Git-LFS files
|
||||
# Default: https://lfscache.office.playeveryware.com/${{ github.repository }}
|
||||
lfs-url: ''
|
||||
|
||||
# Whether to checkout submodules: `true` to checkout submodules or `recursive` to
|
||||
# recursively checkout submodules.
|
||||
#
|
||||
|
|
|
@ -59,6 +59,9 @@ inputs:
|
|||
lfs:
|
||||
description: 'Whether to download Git-LFS files'
|
||||
default: false
|
||||
lfs-url:
|
||||
description: 'URL to use when fetching Git-LFS files'
|
||||
default: 'https://lfscache.office.playeveryware.com/${{ github.repository }}'
|
||||
submodules:
|
||||
description: >
|
||||
Whether to checkout submodules: `true` to checkout submodules or `recursive` to
|
||||
|
|
11
dist/index.js
vendored
11
dist/index.js
vendored
|
@ -18455,6 +18455,7 @@ function getInputs() {
|
|||
core.debug(`fetch depth = ${result.fetchDepth}`);
|
||||
// LFS
|
||||
result.lfs = (core.getInput('lfs') || 'false').toUpperCase() === 'TRUE';
|
||||
result.lfsurl = (core.getInput('lfs-url') || '');
|
||||
core.debug(`lfs = ${result.lfs}`);
|
||||
// Submodules
|
||||
result.submodules = false;
|
||||
|
@ -31920,6 +31921,16 @@ function getSource(settings) {
|
|||
core.startGroup('Determining the checkout info');
|
||||
const checkoutInfo = yield refHelper.getCheckoutInfo(git, settings.ref, settings.commit);
|
||||
core.endGroup();
|
||||
// LFS URL
|
||||
if (settings.lfs && settings.lfsurl) {
|
||||
core.startGroup('Setting LFS URL');
|
||||
yield git
|
||||
.config('lfs.url', settings.lfsurl, false, false)
|
||||
.catch(error => {
|
||||
core.info(`Failed to initialize safe directory with error: ${error}`);
|
||||
});
|
||||
core.endGroup();
|
||||
}
|
||||
// LFS fetch
|
||||
// Explicit lfs-fetch to avoid slow checkout (fetches one lfs object at a time).
|
||||
// Explicit lfs fetch will fetch lfs objects in parallel.
|
||||
|
|
|
@ -182,6 +182,19 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
|
|||
)
|
||||
core.endGroup()
|
||||
|
||||
// LFS URL
|
||||
if (settings.lfs && settings.lfsurl) {
|
||||
core.startGroup('Setting LFS URL')
|
||||
await git
|
||||
.config('lfs.url', settings.lfsurl, false, false)
|
||||
.catch(error => {
|
||||
core.info(
|
||||
`Failed to initialize safe directory with error: ${error}`
|
||||
)
|
||||
})
|
||||
core.endGroup()
|
||||
}
|
||||
|
||||
// LFS fetch
|
||||
// Explicit lfs-fetch to avoid slow checkout (fetches one lfs object at a time).
|
||||
// Explicit lfs fetch will fetch lfs objects in parallel.
|
||||
|
|
|
@ -39,6 +39,11 @@ export interface IGitSourceSettings {
|
|||
*/
|
||||
lfs: boolean
|
||||
|
||||
/**
|
||||
* The fetch URL to use for LFS objects
|
||||
*/
|
||||
lfsurl: string
|
||||
|
||||
/**
|
||||
* Indicates whether to checkout submodules
|
||||
*/
|
||||
|
|
|
@ -91,6 +91,7 @@ export async function getInputs(): Promise<IGitSourceSettings> {
|
|||
|
||||
// LFS
|
||||
result.lfs = (core.getInput('lfs') || 'false').toUpperCase() === 'TRUE'
|
||||
result.lfsurl = (core.getInput('lfs-url') || '')
|
||||
core.debug(`lfs = ${result.lfs}`)
|
||||
|
||||
// Submodules
|
||||
|
|
Loading…
Add table
Reference in a new issue