Skip to content

Commit

Permalink
Try upload teh proxy logs
Browse files Browse the repository at this point in the history
  • Loading branch information
marcogario committed Aug 15, 2024
1 parent 7baf392 commit 7156568
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 9 deletions.
15 changes: 11 additions & 4 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.

22 changes: 18 additions & 4 deletions src/start-proxy-action-post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +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 artifact from "@actions/artifact";


import * as core from "@actions/core";

Expand All @@ -29,9 +30,22 @@ async function runWrapper() {

if ((config && config.debugMode) || core.isDebug()) {
const logFilePath = core.getState("proxy-log-file");
if (logFilePath) {
const readStream = fs.createReadStream(logFilePath);
readStream.pipe(process.stdout, { end: true });
core.info(
"Debug mode is on. Uploading proxy log as Actions debugging artifact...",
);
try {
await artifact.create().uploadArtifact(
"proxy-log-file",
[logFilePath],
"",
{
continueOnError: true,
retentionDays: 7,
},
);
} catch (e) {
// A failure to upload debug artifacts should not fail the entire action.
core.warning(`Failed to upload debug artifacts: ${e}`);
}
}
}
Expand Down

0 comments on commit 7156568

Please sign in to comment.