Fixes #120 Artifacts can be removed even when new ones aren't provided
This commit is contained in:
@@ -10,7 +10,6 @@ export class GithubArtifactUploader implements ArtifactUploader {
|
||||
constructor(
|
||||
private releases: Releases,
|
||||
private replacesExistingArtifacts: boolean = true,
|
||||
private removeArtifacts: boolean = false,
|
||||
private throwsUploadErrors: boolean = false,
|
||||
) {
|
||||
}
|
||||
@@ -21,9 +20,6 @@ export class GithubArtifactUploader implements ArtifactUploader {
|
||||
if (this.replacesExistingArtifacts) {
|
||||
await this.deleteUpdatedArtifacts(artifacts, releaseId)
|
||||
}
|
||||
if (this.removeArtifacts) {
|
||||
await this.deleteUploadedArtifacts(releaseId)
|
||||
}
|
||||
for (const artifact of artifacts) {
|
||||
await this.uploadArtifact(artifact, releaseId, uploadUrl)
|
||||
}
|
||||
@@ -69,13 +65,4 @@ export class GithubArtifactUploader implements ArtifactUploader {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async deleteUploadedArtifacts(releaseId: number): Promise<void> {
|
||||
const releaseAssets = await this.releases.listArtifactsForRelease(releaseId)
|
||||
for (const artifact of releaseAssets) {
|
||||
const asset = artifact
|
||||
core.debug(`Deleting existing artifact ${artifact.name}...`)
|
||||
await this.releases.deleteArtifact(asset.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user