1
Fork 0
mirror of https://gitea.com/actions/checkout.git synced 2024-11-10 02:35:56 +01:00

output stderr

This commit is contained in:
Julius Lehmann 2024-05-28 09:04:21 +02:00
parent 9b382aeccb
commit 687da9f3dc
No known key found for this signature in database
GPG key ID: 12B64BBC42D04103
3 changed files with 14 additions and 28 deletions

20
dist/index.js vendored
View file

@ -356,9 +356,6 @@ class GitAuthHelper {
if (!configPath && !globalConfig) { if (!configPath && !globalConfig) {
configPath = path.join(this.git.getWorkingDirectory(), '.git', 'config'); configPath = path.join(this.git.getWorkingDirectory(), '.git', 'config');
} }
// Configure a placeholder value. This approach avoids the credential being captured
// by process creation audit events, which are commonly logged. For more information,
// refer to https://docs.microsoft.com/en-us/windows-server/identity/ad-ds/manage/component-updates/command-line-process-auditing
yield this.git.config(this.tokenConfigKey, `"store --file ${this.credentialStorePath}"`, globalConfig); yield this.git.config(this.tokenConfigKey, `"store --file ${this.credentialStorePath}"`, globalConfig);
}); });
} }
@ -874,24 +871,20 @@ class GitCommandManager {
for (const key of Object.keys(this.gitEnv)) { for (const key of Object.keys(this.gitEnv)) {
env[key] = this.gitEnv[key]; env[key] = this.gitEnv[key];
} }
const defaultListener = {
stdout: (data) => {
stdout.push(data.toString());
}
};
const mergedListeners = Object.assign(Object.assign({}, defaultListener), customListeners);
const stdout = [];
const options = { const options = {
cwd: this.workingDirectory, cwd: this.workingDirectory,
env, env,
silent, silent,
ignoreReturnCode: allowAllExitCodes, ignoreReturnCode: allowAllExitCodes,
listeners: mergedListeners listeners: customListeners
}; };
result.exitCode = yield exec.exec(`"${this.gitPath}"`, args, options); let execOutput = yield exec.getExecOutput(`"${this.gitPath}"`, args, options);
result.stdout = stdout.join(''); result.exitCode = execOutput.exitCode;
result.stdout = execOutput.stdout;
result.stderr = execOutput.stderr;
core.debug(result.exitCode.toString()); core.debug(result.exitCode.toString());
core.debug(result.stdout); core.debug(result.stdout);
core.debug(result.stderr);
return result; return result;
}); });
} }
@ -963,6 +956,7 @@ class GitCommandManager {
class GitOutput { class GitOutput {
constructor() { constructor() {
this.stdout = ''; this.stdout = '';
this.stderr = '';
this.exitCode = 0; this.exitCode = 0;
} }
} }

View file

@ -276,9 +276,6 @@ class GitAuthHelper {
configPath = path.join(this.git.getWorkingDirectory(), '.git', 'config') configPath = path.join(this.git.getWorkingDirectory(), '.git', 'config')
} }
// Configure a placeholder value. This approach avoids the credential being captured
// by process creation audit events, which are commonly logged. For more information,
// refer to https://docs.microsoft.com/en-us/windows-server/identity/ad-ds/manage/component-updates/command-line-process-auditing
await this.git.config( await this.git.config(
this.tokenConfigKey, this.tokenConfigKey,
`"store --file ${this.credentialStorePath}"`, `"store --file ${this.credentialStorePath}"`,

View file

@ -522,28 +522,22 @@ class GitCommandManager {
env[key] = this.gitEnv[key] env[key] = this.gitEnv[key]
} }
const defaultListener = {
stdout: (data: Buffer) => {
stdout.push(data.toString())
}
}
const mergedListeners = {...defaultListener, ...customListeners}
const stdout: string[] = []
const options = { const options = {
cwd: this.workingDirectory, cwd: this.workingDirectory,
env, env,
silent, silent,
ignoreReturnCode: allowAllExitCodes, ignoreReturnCode: allowAllExitCodes,
listeners: mergedListeners listeners: customListeners
} }
result.exitCode = await exec.exec(`"${this.gitPath}"`, args, options) let execOutput = await exec.getExecOutput(`"${this.gitPath}"`, args, options)
result.stdout = stdout.join('') result.exitCode = execOutput.exitCode
result.stdout = execOutput.stdout
result.stderr = execOutput.stderr
core.debug(result.exitCode.toString()) core.debug(result.exitCode.toString())
core.debug(result.stdout) core.debug(result.stdout)
core.debug(result.stderr)
return result return result
} }
@ -631,5 +625,6 @@ class GitCommandManager {
class GitOutput { class GitOutput {
stdout = '' stdout = ''
stderr = ''
exitCode = 0 exitCode = 0
} }