From 2f547d07f23dec7f4a96fc091165260dcbe59529 Mon Sep 17 00:00:00 2001 From: Andrew Mehta Date: Thu, 24 Sep 2026 16:08:29 -0600 Subject: [PATCH] feat: make show-progress control checkout verbosity, not just fetch Previously checkout/checkoutDetach always ran with --progress regardless of the show-progress input, and settings.showProgress was never propagated into fetchOptions. Thread showProgress through checkout and checkoutDetach so they use --quiet when show-progress is false, giving a genuinely quiet checkout when show-progress: false is set. Ported from schlags/checkout (show-progress-required branch) onto current actions/checkout main. --- README.md | 2 +- action.yml | 2 +- dist/index.js | 15 +++++++++------ src/git-command-manager.ts | 16 ++++++++++------ src/git-directory-helper.ts | 2 +- src/git-source-provider.ts | 10 +++++++++- src/git-source-settings.ts | 3 ++- 7 files changed, 33 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 5509e7d1..1a0756bf 100644 --- a/README.md +++ b/README.md @@ -141,7 +141,7 @@ Please refer to the [release page](https://github.com/actions/checkout/releases/ # Default: false fetch-tags: '' - # Whether to show progress status output when fetching. + # Whether to show progress status output for git operations. # Default: true show-progress: '' diff --git a/action.yml b/action.yml index 5b0524f7..175fad67 100644 --- a/action.yml +++ b/action.yml @@ -78,7 +78,7 @@ inputs: description: 'Whether to fetch tags, even if fetch-depth > 0.' default: false show-progress: - description: 'Whether to show progress status output when fetching.' + description: 'Whether to show progress status output for git operations.' default: true lfs: description: 'Whether to download Git-LFS files' diff --git a/dist/index.js b/dist/index.js index 06ae5d22..5ac3b85e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -35701,8 +35701,8 @@ class GitCommandManager { const sparseCheckoutPath = external_path_namespaceObject.join(this.workingDirectory, output.stdout.trimRight()); await external_fs_namespaceObject.promises.appendFile(sparseCheckoutPath, `\n${sparseCheckout.join('\n')}\n`); } - async checkout(ref, startPoint) { - const args = ['checkout', '--progress', '--force']; + async checkout(ref, startPoint, showProgress) { + const args = ['checkout', showProgress ? '--progress' : '--quiet', '--force']; if (startPoint) { args.push('-B', ref, startPoint); } @@ -35711,8 +35711,8 @@ class GitCommandManager { } await this.execGit(args); } - async checkoutDetach() { - const args = ['checkout', '--detach']; + async checkoutDetach(showProgress) { + const args = ['checkout', '--detach', showProgress ? '--progress' : '--quiet']; await this.execGit(args); } async config(configKey, configValue, globalConfig, add, configFile) { @@ -36127,7 +36127,7 @@ async function prepareExistingDirectory(git, repositoryPath, repositoryUrl, clea startGroup('Removing previously created refs, to avoid conflicts'); // Checkout detached HEAD if (!(await git.isDetached())) { - await git.checkoutDetach(); + await git.checkoutDetach(false); } // Remove all refs/heads/* let branches = await git.branchList(false); @@ -41807,6 +41807,9 @@ async function getSource(settings) { // Fetch startGroup('Fetching the repository'); const fetchOptions = {}; + if (settings.showProgress) { + fetchOptions.showProgress = true; + } if (settings.filter) { fetchOptions.filter = settings.filter; } @@ -41877,7 +41880,7 @@ async function getSource(settings) { } // Checkout startGroup('Checking out the ref'); - await git.checkout(checkoutInfo.ref, checkoutInfo.startPoint); + await git.checkout(checkoutInfo.ref, checkoutInfo.startPoint, settings.showProgress); endGroup(); // Submodules if (settings.submodules) { diff --git a/src/git-command-manager.ts b/src/git-command-manager.ts index 84316589..6bad2320 100644 --- a/src/git-command-manager.ts +++ b/src/git-command-manager.ts @@ -22,8 +22,8 @@ export interface IGitCommandManager { disableSparseCheckout(): Promise sparseCheckout(sparseCheckout: string[]): Promise sparseCheckoutNonConeMode(sparseCheckout: string[]): Promise - checkout(ref: string, startPoint: string): Promise - checkoutDetach(): Promise + checkout(ref: string, startPoint: string, showProgress: boolean): Promise + checkoutDetach(showProgress: boolean): Promise config( configKey: string, configValue: string, @@ -220,8 +220,12 @@ class GitCommandManager { ) } - async checkout(ref: string, startPoint: string): Promise { - const args = ['checkout', '--progress', '--force'] + async checkout( + ref: string, + startPoint: string, + showProgress: boolean + ): Promise { + const args = ['checkout', showProgress ? '--progress' : '--quiet', '--force'] if (startPoint) { args.push('-B', ref, startPoint) } else { @@ -231,8 +235,8 @@ class GitCommandManager { await this.execGit(args) } - async checkoutDetach(): Promise { - const args = ['checkout', '--detach'] + async checkoutDetach(showProgress: boolean): Promise { + const args = ['checkout', '--detach', showProgress ? '--progress' : '--quiet'] await this.execGit(args) } diff --git a/src/git-directory-helper.ts b/src/git-directory-helper.ts index c73a1a40..ff86a141 100644 --- a/src/git-directory-helper.ts +++ b/src/git-directory-helper.ts @@ -49,7 +49,7 @@ export async function prepareExistingDirectory( core.startGroup('Removing previously created refs, to avoid conflicts') // Checkout detached HEAD if (!(await git.isDetached())) { - await git.checkoutDetach() + await git.checkoutDetach(false) } // Remove all refs/heads/* diff --git a/src/git-source-provider.ts b/src/git-source-provider.ts index b9c1d357..24942c8c 100644 --- a/src/git-source-provider.ts +++ b/src/git-source-provider.ts @@ -179,6 +179,10 @@ export async function getSource(settings: IGitSourceSettings): Promise { showProgress?: boolean } = {} + if (settings.showProgress) { + fetchOptions.showProgress = true + } + if (settings.filter) { fetchOptions.filter = settings.filter } else if (settings.sparseCheckout) { @@ -268,7 +272,11 @@ export async function getSource(settings: IGitSourceSettings): Promise { // Checkout core.startGroup('Checking out the ref') - await git.checkout(checkoutInfo.ref, checkoutInfo.startPoint) + await git.checkout( + checkoutInfo.ref, + checkoutInfo.startPoint, + settings.showProgress + ) core.endGroup() // Submodules diff --git a/src/git-source-settings.ts b/src/git-source-settings.ts index 79041c43..10d8f12e 100644 --- a/src/git-source-settings.ts +++ b/src/git-source-settings.ts @@ -55,7 +55,8 @@ export interface IGitSourceSettings { 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