Skip to content

Commit 0b84d89

Browse files
committed
Try upload teh proxy logs
1 parent 7baf392 commit 0b84d89

File tree

3 files changed

+33
-10
lines changed

3 files changed

+33
-10
lines changed

lib/start-proxy-action-post.js

+13-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/start-proxy-action-post.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/start-proxy-action-post.ts

+19-5
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
* It will run after the all steps in this job, in reverse order in relation to
44
* other `post:` hooks.
55
*/
6-
import * as fs from "fs";
7-
6+
import * as artifact from "@actions/artifact";
87
import * as core from "@actions/core";
98

109
import * as actionsUtil from "./actions-util";
@@ -29,9 +28,24 @@ async function runWrapper() {
2928

3029
if ((config && config.debugMode) || core.isDebug()) {
3130
const logFilePath = core.getState("proxy-log-file");
32-
if (logFilePath) {
33-
const readStream = fs.createReadStream(logFilePath);
34-
readStream.pipe(process.stdout, { end: true });
31+
core.info(
32+
"Debug mode is on. Uploading proxy log as Actions debugging artifact...",
33+
);
34+
try {
35+
await artifact
36+
.create()
37+
.uploadArtifact(
38+
"proxy-log-file",
39+
[logFilePath],
40+
actionsUtil.getTemporaryDirectory(),
41+
{
42+
continueOnError: true,
43+
retentionDays: 7,
44+
},
45+
);
46+
} catch (e) {
47+
// A failure to upload debug artifacts should not fail the entire action.
48+
core.warning(`Failed to upload debug artifacts: ${e}`);
3549
}
3650
}
3751
}

0 commit comments

Comments
 (0)