mirror of
https://code.forgejo.org/actions/upload-artifact.git
synced 2026-03-22 16:05:55 +03:00
fix: implement overwrite for skip archive artifact
When archive is set to false and overwrite is true, it now deletes existing artifact by filename before uploading new one.
This commit is contained in:
parent
bbbca2ddaa
commit
60f4f0971b
3 changed files with 43 additions and 2 deletions
|
|
@ -327,4 +327,26 @@ describe('upload', () => {
|
|||
)
|
||||
expect(artifact.default.uploadArtifact).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
test('overwrite artifact by filename when archive is false', async () => {
|
||||
mockInputs({
|
||||
[Inputs.Archive]: false,
|
||||
[Inputs.Overwrite]: true
|
||||
})
|
||||
|
||||
mockFindFilesToUpload.mockResolvedValue({
|
||||
filesToUpload: [fixtures.filesToUpload[0]],
|
||||
rootDirectory: fixtures.rootDirectory
|
||||
})
|
||||
|
||||
jest.spyOn(artifact.default, 'deleteArtifact').mockResolvedValue({
|
||||
id: 1337
|
||||
})
|
||||
|
||||
await run()
|
||||
|
||||
expect(artifact.default.deleteArtifact).toHaveBeenCalledWith(
|
||||
fixtures.filesToUpload[0].split('/').pop() || ''
|
||||
)
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue