1
0
Fork 0

delete example

pull/1626/head
Rob Herley 2024-01-17 18:21:25 -05:00
parent 2ad687a32e
commit abe0bd98df
No known key found for this signature in database
GPG Key ID: D1602042C3543B06
1 changed files with 14 additions and 0 deletions

View File

@ -12,6 +12,7 @@ This is the core library that powers the [`@actions/upload-artifact`](https://gi
- [Quick Start](#quick-start)
- [Examples](#examples)
- [Upload and Download](#upload-and-download)
- [Delete an Artifact](#delete-an-artifact)
- [Downloading from other workflow runs or repos](#downloading-from-other-workflow-runs-or-repos)
- [Speeding up large uploads](#speeding-up-large-uploads)
- [Additional Resources](#additional-resources)
@ -106,6 +107,19 @@ const {downloadPath} = await artifact.downloadArtifact(id, {
console.log(`Downloaded artifact ${id} to: ${downloadPath}`)
```
### Delete an Artifact
To delete an artifact, all you need is the name. Also supports options to delete from other repos/runs given a token with proper permissions is supplied.
```js
const {id} = await artifact.deleteArtifact(
// name of the artifact
'my-artifact'
)
console.log(`Deleted Artifact ID: ${id}`)
```
### Downloading from other workflow runs or repos
It may be useful to download Artifacts from other workflow runs, or even other repositories. By default, the permissions are scoped so they can only download Artifacts within the current workflow run. To elevate permissions for this scenario, you must specify `options.findBy` to `downloadArtifact`.