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 0b84d89
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 10 deletions.
17 changes: 13 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.

24 changes: 19 additions & 5 deletions src/start-proxy-action-post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
* 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";

import * as actionsUtil from "./actions-util";
Expand All @@ -29,9 +28,24 @@ 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],
actionsUtil.getTemporaryDirectory(),
{
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 0b84d89

Please sign in to comment.