mirror of
https://github.com/actions/checkout.git
synced 2026-03-01 08:31:03 +08:00
Merge 197ee88ce5 into 0c366fd6a8
This commit is contained in:
commit
3a1d1109c0
@ -133,7 +133,7 @@ Please refer to the [release page](https://github.com/actions/checkout/releases/
|
|||||||
# Default: false
|
# Default: false
|
||||||
fetch-tags: ''
|
fetch-tags: ''
|
||||||
|
|
||||||
# Whether to show progress status output when fetching.
|
# Whether to show progress status output for git operations.
|
||||||
# Default: true
|
# Default: true
|
||||||
show-progress: ''
|
show-progress: ''
|
||||||
|
|
||||||
|
|||||||
@ -78,7 +78,7 @@ inputs:
|
|||||||
description: 'Whether to fetch tags, even if fetch-depth > 0.'
|
description: 'Whether to fetch tags, even if fetch-depth > 0.'
|
||||||
default: false
|
default: false
|
||||||
show-progress:
|
show-progress:
|
||||||
description: 'Whether to show progress status output when fetching.'
|
description: 'Whether to show progress status output for git operations.'
|
||||||
default: true
|
default: true
|
||||||
lfs:
|
lfs:
|
||||||
description: 'Whether to download Git-LFS files'
|
description: 'Whether to download Git-LFS files'
|
||||||
|
|||||||
15
dist/index.js
vendored
15
dist/index.js
vendored
@ -780,9 +780,9 @@ class GitCommandManager {
|
|||||||
yield fs.promises.appendFile(sparseCheckoutPath, `\n${sparseCheckout.join('\n')}\n`);
|
yield fs.promises.appendFile(sparseCheckoutPath, `\n${sparseCheckout.join('\n')}\n`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
checkout(ref, startPoint) {
|
checkout(ref, startPoint, showProgress) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const args = ['checkout', '--progress', '--force'];
|
const args = ['checkout', showProgress ? '--progress' : '--quiet', '--force'];
|
||||||
if (startPoint) {
|
if (startPoint) {
|
||||||
args.push('-B', ref, startPoint);
|
args.push('-B', ref, startPoint);
|
||||||
}
|
}
|
||||||
@ -792,9 +792,9 @@ class GitCommandManager {
|
|||||||
yield this.execGit(args);
|
yield this.execGit(args);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
checkoutDetach() {
|
checkoutDetach(showProgress) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const args = ['checkout', '--detach'];
|
const args = ['checkout', '--detach', showProgress ? '--progress' : '--quiet'];
|
||||||
yield this.execGit(args);
|
yield this.execGit(args);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -1310,7 +1310,7 @@ function prepareExistingDirectory(git, repositoryPath, repositoryUrl, clean, ref
|
|||||||
core.startGroup('Removing previously created refs, to avoid conflicts');
|
core.startGroup('Removing previously created refs, to avoid conflicts');
|
||||||
// Checkout detached HEAD
|
// Checkout detached HEAD
|
||||||
if (!(yield git.isDetached())) {
|
if (!(yield git.isDetached())) {
|
||||||
yield git.checkoutDetach();
|
yield git.checkoutDetach(false);
|
||||||
}
|
}
|
||||||
// Remove all refs/heads/*
|
// Remove all refs/heads/*
|
||||||
let branches = yield git.branchList(false);
|
let branches = yield git.branchList(false);
|
||||||
@ -1523,6 +1523,9 @@ function getSource(settings) {
|
|||||||
// Fetch
|
// Fetch
|
||||||
core.startGroup('Fetching the repository');
|
core.startGroup('Fetching the repository');
|
||||||
const fetchOptions = {};
|
const fetchOptions = {};
|
||||||
|
if (settings.showProgress) {
|
||||||
|
fetchOptions.showProgress = true;
|
||||||
|
}
|
||||||
if (settings.filter) {
|
if (settings.filter) {
|
||||||
fetchOptions.filter = settings.filter;
|
fetchOptions.filter = settings.filter;
|
||||||
}
|
}
|
||||||
@ -1593,7 +1596,7 @@ function getSource(settings) {
|
|||||||
}
|
}
|
||||||
// Checkout
|
// Checkout
|
||||||
core.startGroup('Checking out the ref');
|
core.startGroup('Checking out the ref');
|
||||||
yield git.checkout(checkoutInfo.ref, checkoutInfo.startPoint);
|
yield git.checkout(checkoutInfo.ref, checkoutInfo.startPoint, settings.showProgress);
|
||||||
core.endGroup();
|
core.endGroup();
|
||||||
// Submodules
|
// Submodules
|
||||||
if (settings.submodules) {
|
if (settings.submodules) {
|
||||||
|
|||||||
@ -22,8 +22,8 @@ export interface IGitCommandManager {
|
|||||||
disableSparseCheckout(): Promise<void>
|
disableSparseCheckout(): Promise<void>
|
||||||
sparseCheckout(sparseCheckout: string[]): Promise<void>
|
sparseCheckout(sparseCheckout: string[]): Promise<void>
|
||||||
sparseCheckoutNonConeMode(sparseCheckout: string[]): Promise<void>
|
sparseCheckoutNonConeMode(sparseCheckout: string[]): Promise<void>
|
||||||
checkout(ref: string, startPoint: string): Promise<void>
|
checkout(ref: string, startPoint: string, showProgress: boolean): Promise<void>
|
||||||
checkoutDetach(): Promise<void>
|
checkoutDetach(showProgress: boolean): Promise<void>
|
||||||
config(
|
config(
|
||||||
configKey: string,
|
configKey: string,
|
||||||
configValue: string,
|
configValue: string,
|
||||||
@ -220,8 +220,8 @@ class GitCommandManager {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkout(ref: string, startPoint: string): Promise<void> {
|
async checkout(ref: string, startPoint: string, showProgress: boolean): Promise<void> {
|
||||||
const args = ['checkout', '--progress', '--force']
|
const args = ['checkout', showProgress ? '--progress' : '--quiet', '--force']
|
||||||
if (startPoint) {
|
if (startPoint) {
|
||||||
args.push('-B', ref, startPoint)
|
args.push('-B', ref, startPoint)
|
||||||
} else {
|
} else {
|
||||||
@ -231,8 +231,8 @@ class GitCommandManager {
|
|||||||
await this.execGit(args)
|
await this.execGit(args)
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkoutDetach(): Promise<void> {
|
async checkoutDetach(showProgress: boolean): Promise<void> {
|
||||||
const args = ['checkout', '--detach']
|
const args = ['checkout', '--detach', showProgress ? '--progress' : '--quiet']
|
||||||
await this.execGit(args)
|
await this.execGit(args)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -49,7 +49,7 @@ export async function prepareExistingDirectory(
|
|||||||
core.startGroup('Removing previously created refs, to avoid conflicts')
|
core.startGroup('Removing previously created refs, to avoid conflicts')
|
||||||
// Checkout detached HEAD
|
// Checkout detached HEAD
|
||||||
if (!(await git.isDetached())) {
|
if (!(await git.isDetached())) {
|
||||||
await git.checkoutDetach()
|
await git.checkoutDetach(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove all refs/heads/*
|
// Remove all refs/heads/*
|
||||||
|
|||||||
@ -162,6 +162,10 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
|
|||||||
showProgress?: boolean
|
showProgress?: boolean
|
||||||
} = {}
|
} = {}
|
||||||
|
|
||||||
|
if (settings.showProgress) {
|
||||||
|
fetchOptions.showProgress = true
|
||||||
|
}
|
||||||
|
|
||||||
if (settings.filter) {
|
if (settings.filter) {
|
||||||
fetchOptions.filter = settings.filter
|
fetchOptions.filter = settings.filter
|
||||||
} else if (settings.sparseCheckout) {
|
} else if (settings.sparseCheckout) {
|
||||||
@ -251,7 +255,7 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
|
|||||||
|
|
||||||
// Checkout
|
// Checkout
|
||||||
core.startGroup('Checking out the ref')
|
core.startGroup('Checking out the ref')
|
||||||
await git.checkout(checkoutInfo.ref, checkoutInfo.startPoint)
|
await git.checkout(checkoutInfo.ref, checkoutInfo.startPoint, settings.showProgress)
|
||||||
core.endGroup()
|
core.endGroup()
|
||||||
|
|
||||||
// Submodules
|
// Submodules
|
||||||
|
|||||||
@ -55,7 +55,8 @@ export interface IGitSourceSettings {
|
|||||||
fetchTags: boolean
|
fetchTags: boolean
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether to use the --progress option when fetching
|
* Indicates whether to show progress status output for git operations.
|
||||||
|
* When false, git commands use --quiet to suppress verbose output.
|
||||||
*/
|
*/
|
||||||
showProgress: boolean
|
showProgress: boolean
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user