Skip to content

Commit

Permalink
Print proxy log when debugging is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
aibaars committed Jul 24, 2024
1 parent 7b43b7c commit 6186179
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 2 deletions.
8 changes: 8 additions & 0 deletions lib/start-proxy-action-post.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/start-proxy-action-post.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/start-proxy-action.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/start-proxy-action.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions src/start-proxy-action-post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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();
2 changes: 2 additions & 0 deletions src/start-proxy-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6186179

Please sign in to comment.