Add artifact upload error handling
Some checks failed
PR Checks / check_pr (push) Has been cancelled
Some checks failed
PR Checks / check_pr (push) Has been cancelled
This commit is contained in:
@@ -8,7 +8,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||||
|
result["default"] = mod;
|
||||||
|
return result;
|
||||||
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const core = __importStar(require("@actions/core"));
|
||||||
class GithubArtifactUploader {
|
class GithubArtifactUploader {
|
||||||
constructor(releases) {
|
constructor(releases) {
|
||||||
this.releases = releases;
|
this.releases = releases;
|
||||||
@@ -16,7 +24,13 @@ class GithubArtifactUploader {
|
|||||||
uploadArtifacts(artifacts, uploadUrl) {
|
uploadArtifacts(artifacts, uploadUrl) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
artifacts.forEach((artifact) => __awaiter(this, void 0, void 0, function* () {
|
artifacts.forEach((artifact) => __awaiter(this, void 0, void 0, function* () {
|
||||||
yield this.releases.uploadArtifact(uploadUrl, artifact.contentLength, artifact.contentType, artifact.readFile(), artifact.name);
|
try {
|
||||||
|
yield this.releases.uploadArtifact(uploadUrl, artifact.contentLength, artifact.contentType, artifact.readFile(), artifact.name);
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
const message = `Failed to upload artifact ${artifact.name}. Does it already exist?`;
|
||||||
|
core.warning(message);
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import * as core from '@actions/core';
|
||||||
import { Artifact } from "./Artifact";
|
import { Artifact } from "./Artifact";
|
||||||
import { Releases } from "./Releases";
|
import { Releases } from "./Releases";
|
||||||
|
|
||||||
@@ -14,11 +15,16 @@ export class GithubArtifactUploader implements ArtifactUploader {
|
|||||||
|
|
||||||
async uploadArtifacts(artifacts: Artifact[], uploadUrl: string) {
|
async uploadArtifacts(artifacts: Artifact[], uploadUrl: string) {
|
||||||
artifacts.forEach(async artifact => {
|
artifacts.forEach(async artifact => {
|
||||||
await this.releases.uploadArtifact(uploadUrl,
|
try {
|
||||||
artifact.contentLength,
|
await this.releases.uploadArtifact(uploadUrl,
|
||||||
artifact.contentType,
|
artifact.contentLength,
|
||||||
artifact.readFile(),
|
artifact.contentType,
|
||||||
artifact.name)
|
artifact.readFile(),
|
||||||
|
artifact.name)
|
||||||
|
} catch(error) {
|
||||||
|
const message = `Failed to upload artifact ${artifact.name}. Does it already exist?`
|
||||||
|
core.warning(message)
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user