generated from actions/typescript-action
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #120 Artifacts can be removed even when new ones aren't provided
- Loading branch information
Showing
7 changed files
with
55 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import {Releases} from "./Releases"; | ||
import * as core from "@actions/core"; | ||
|
||
export interface ArtifactDestroyer { | ||
destroyArtifacts(releaseId: number): Promise<void> | ||
} | ||
|
||
export class GithubArtifactDestroyer implements ArtifactDestroyer { | ||
constructor(private releases: Releases) { | ||
} | ||
|
||
async destroyArtifacts(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) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters