1
0
Fork 0

add integration test for delete

pull/1626/head
Rob Herley 2024-01-17 17:54:10 -05:00
parent 2f5fb3f92b
commit 2ad687a32e
No known key found for this signature in database
GPG Key ID: D1602042C3543B06
1 changed files with 29 additions and 1 deletions

View File

@ -72,7 +72,7 @@ jobs:
console.log('Successfully blocked second artifact upload') console.log('Successfully blocked second artifact upload')
} }
verify: verify:
name: Verify name: Verify and Delete
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [upload] needs: [upload]
steps: steps:
@ -164,3 +164,31 @@ jobs:
} }
} }
} }
- name: Delete Artifacts
uses: actions/github-script@v7
with:
script: |
const {default: artifactClient} = require('./packages/artifact/lib/artifact')
const artifactsToDelete = [
'my-artifact-ubuntu-latest',
'my-artifact-windows-latest',
'my-artifact-macos-latest'
]
for (const artifactName of artifactsToDelete) {
const {id} = await artifactClient.deleteArtifact(artifactName)
}
const {artifacts} = await artifactClient.listArtifacts({latest: true})
const foundArtifacts = artifacts.filter(artifact =>
artifactsToDelete.includes(artifact.name)
)
if (foundArtifacts.length !== 0) {
console.log('Unexpected length of found artifacts:', foundArtifacts)
throw new Error(
`Expected 0 artifacts but found ${foundArtifacts.length} artifacts.`
)
}