Add artifact upload error handling

This commit is contained in:
Nick Cipollo
2020-01-02 23:12:45 -05:00
parent 04d64ce68e
commit cffd02c48e
2 changed files with 26 additions and 6 deletions

View File

@@ -1,3 +1,4 @@
import * as core from '@actions/core';
import { Artifact } from "./Artifact";
import { Releases } from "./Releases";
@@ -14,11 +15,16 @@ export class GithubArtifactUploader implements ArtifactUploader {
async uploadArtifacts(artifacts: Artifact[], uploadUrl: string) {
artifacts.forEach(async artifact => {
await this.releases.uploadArtifact(uploadUrl,
artifact.contentLength,
artifact.contentType,
artifact.readFile(),
artifact.name)
try {
await 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)
}
});
}
}