mirror of
				https://github.com/actions/checkout.git
				synced 2025-10-31 11:13:59 +08:00 
			
		
		
		
	Remove unneeded commit information from build logs (#345)
* Remove unneeded commit information from stdout
This commit is contained in:
		| @@ -31,7 +31,7 @@ export interface IGitCommandManager { | ||||
|   isDetached(): Promise<boolean> | ||||
|   lfsFetch(ref: string): Promise<void> | ||||
|   lfsInstall(): Promise<void> | ||||
|   log1(): Promise<string> | ||||
|   log1(format?: string): Promise<string> | ||||
|   remoteAdd(remoteName: string, remoteUrl: string): Promise<void> | ||||
|   removeEnvironmentVariable(name: string): void | ||||
|   revParse(ref: string): Promise<string> | ||||
| @@ -254,8 +254,10 @@ class GitCommandManager { | ||||
|     await this.execGit(['lfs', 'install', '--local']) | ||||
|   } | ||||
|  | ||||
|   async log1(): Promise<string> { | ||||
|     const output = await this.execGit(['log', '-1']) | ||||
|   async log1(format?: string): Promise<string> { | ||||
|     var args = format ? ['log', '-1', format] : ['log', '-1'] | ||||
|     var silent = format ? false : true | ||||
|     const output = await this.execGit(args, false, silent) | ||||
|     return output.stdout | ||||
|   } | ||||
|  | ||||
| @@ -390,7 +392,8 @@ class GitCommandManager { | ||||
|  | ||||
|   private async execGit( | ||||
|     args: string[], | ||||
|     allowAllExitCodes = false | ||||
|     allowAllExitCodes = false, | ||||
|     silent = false | ||||
|   ): Promise<GitOutput> { | ||||
|     fshelper.directoryExistsSync(this.workingDirectory, true) | ||||
|  | ||||
| @@ -409,6 +412,7 @@ class GitCommandManager { | ||||
|     const options = { | ||||
|       cwd: this.workingDirectory, | ||||
|       env, | ||||
|       silent, | ||||
|       ignoreReturnCode: allowAllExitCodes, | ||||
|       listeners: { | ||||
|         stdout: (data: Buffer) => { | ||||
|   | ||||
| @@ -201,9 +201,12 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> { | ||||
|       } | ||||
|     } | ||||
|  | ||||
|     // Dump some info about the checked out commit | ||||
|     // Get commit information | ||||
|     const commitInfo = await git.log1() | ||||
|  | ||||
|     // Log commit sha | ||||
|     await git.log1("--format='%H'") | ||||
|  | ||||
|     // Check for incorrect pull request merge commit | ||||
|     await refHelper.checkCommitInfo( | ||||
|       settings.authToken, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Thomas Boop
					Thomas Boop