mirror of
https://github.com/github/codeql-action.git
synced 2026-05-20 22:30:29 +00:00
Upload with artifacts-legacy when running GHES, else with artifacts
`@actions/artifacts@v1` is still not yet supported on GHES and we need to maintain backwards compatibility here. If we detect that a user is running on GHES, we fall back on the original `v1` import.
This commit is contained in:
Generated
+19
-6
@@ -29,6 +29,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
* other `post:` hooks.
|
||||
*/
|
||||
const artifact = __importStar(require("@actions/artifact"));
|
||||
const artifactLegacy = __importStar(require("@actions/artifact-legacy"));
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const actionsUtil = __importStar(require("./actions-util"));
|
||||
const configUtils = __importStar(require("./config-utils"));
|
||||
@@ -47,13 +48,25 @@ async function runWrapper() {
|
||||
if ((config && config.debugMode) || core.isDebug()) {
|
||||
const logFilePath = core.getState("proxy-log-file");
|
||||
core.info("Debug mode is on. Uploading proxy log as Actions debugging artifact...");
|
||||
if (config?.gitHubVersion.type === undefined) {
|
||||
core.warning(`Did not upload debug artifacts because cannot determine the GitHub variant running.`);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await artifact
|
||||
.create()
|
||||
.uploadArtifact("proxy-log-file", [logFilePath], actionsUtil.getTemporaryDirectory(), {
|
||||
continueOnError: true,
|
||||
retentionDays: 7,
|
||||
});
|
||||
if (config.gitHubVersion.type === util_1.GitHubVariant.GHES) {
|
||||
await artifactLegacy
|
||||
.create()
|
||||
.uploadArtifact("proxy-log-file", [logFilePath], actionsUtil.getTemporaryDirectory(), {
|
||||
continueOnError: true,
|
||||
retentionDays: 7,
|
||||
});
|
||||
}
|
||||
else {
|
||||
const artifactClient = new artifact.DefaultArtifactClient();
|
||||
await artifactClient.uploadArtifact("proxy-log-file", [logFilePath], actionsUtil.getTemporaryDirectory(), {
|
||||
retentionDays: 7,
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
// A failure to upload debug artifacts should not fail the entire action.
|
||||
|
||||
Reference in New Issue
Block a user