1
0
Fork 0

more delete examples

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

View File

@ -109,7 +109,7 @@ console.log(`Downloaded artifact ${id} to: ${downloadPath}`)
### Delete an Artifact ### 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. To delete an artifact, all you need is the name.
```js ```js
const {id} = await artifact.deleteArtifact( const {id} = await artifact.deleteArtifact(
@ -117,7 +117,29 @@ const {id} = await artifact.deleteArtifact(
'my-artifact' 'my-artifact'
) )
console.log(`Deleted Artifact ID: ${id}`) console.log(`Deleted Artifact ID '${id}'`)
```
It also supports options to delete from other repos/runs given a github token with `actions:write` permissions on the target repository is supplied.
```js
const findBy = {
// must have actions:write permission on target repository
token: process.env['GITHUB_TOKEN'],
workflowRunId: 123,
repositoryOwner: 'actions',
repositoryName: 'toolkit'
}
const {id} = await artifact.deleteArtifact(
// name of the artifact
'my-artifact',
// options to find by other repo/owner
{ findBy }
)
console.log(`Deleted Artifact ID '${id}' from ${findBy.repositoryOwner}/ ${findBy.repositoryName}`)
``` ```
### Downloading from other workflow runs or repos ### Downloading from other workflow runs or repos