Print proxy log when debugging is enabled

This commit is contained in:
Arthur Baars
2024-07-09 12:03:02 +02:00
parent 7b43b7c7ca
commit 6186179441
6 changed files with 22 additions and 2 deletions

View File

@@ -3,6 +3,8 @@
* It will run after the all steps in this job, in reverse order in relation to
* other `post:` hooks.
*/
import * as fs from "fs";
import * as core from "@actions/core";
import { wrapError } from "./util";
@@ -18,6 +20,13 @@ async function runWrapper() {
`start-proxy post-action step failed: ${wrapError(error).message}`,
);
}
if (core.isDebug()) {
const logFilePath = core.getState("proxy-log-file");
if (logFilePath) {
const readStream = fs.createReadStream(logFilePath);
readStream.pipe(process.stdout, { end: true });
}
}
}
void runWrapper();

View File

@@ -90,6 +90,8 @@ async function runWrapper() {
const credentials = JSON.parse(input) as Credential[];
const ca = generateCertificateAuthority();
const proxy_password = actionsUtil.getOptionalInput("proxy_password");
core.saveState("proxy-log-file", logFilePath);
let proxy_auth: BasicAuthCredentials | undefined = undefined;
if (proxy_password) {
core.setSecret(proxy_password);