mirror of
https://github.com/robinraju/release-downloader.git
synced 2026-10-02 08:46:05 +03:00
* fix #729: Remove archive after extraction Almost all uses of this action that will be extracting a release archive will not need the archive after the fact, so I opted to not put this behind a flag option. * Move extraction info log after file removal * Remove unwanted async from rm, fix tests --------- Co-authored-by: Robin Raju <robinraju@users.noreply.github.com>
This commit is contained in:
1 parent
ffd8c6699a
commit
3bd996fb72
2 files changed
+11
-1
No files matched your search
@@ -36,8 +36,10 @@ describe('extract', () => {
|
||||
|
||||
test('extracts a tar.gz archive into a created destination directory', async () => {
|
||||
const destination = path.join(testRoot, 'tar-gz-output')
|
||||
const archivePath = path.join(testRoot, 'tar-zip-ball-only-repo.tar.gz')
|
||||
fs.copyFileSync(fixturePath('tar-zip-ball-only-repo.tar.gz'), archivePath)
|
||||
|
||||
await extract(fixturePath('tar-zip-ball-only-repo.tar.gz'), destination)
|
||||
await extract(archivePath, destination)
|
||||
|
||||
expect(fs.existsSync(destination)).toBe(true)
|
||||
expect(fs.readdirSync(destination).length).toBeGreaterThan(0)
|
||||
|
||||
@@ -50,6 +50,14 @@ export const extract = async (
|
||||
await zip.extract(null, destDir)
|
||||
await zip.close()
|
||||
}
|
||||
|
||||
fs.rm(filePath, err => {
|
||||
if (err) {
|
||||
core.warning(
|
||||
`Failed to delete archive ${filename} after extraction: ${err.message}`
|
||||
)
|
||||
}
|
||||
})
|
||||
core.info(`Extracted ${filename} to ${destDir}`)
|
||||
} catch (err) {
|
||||
// Provide context for extraction failures
|
||||
|
||||
Reference in new issue
Block a user