mirror of
https://github.com/actions/toolkit
synced 2025-05-09 00:22:56 +00:00
@actions/artifact download artifacts (#340)
* Download Artifacts using @actions/artifact
This commit is contained in:
parent
84f1e31b69
commit
f383109dc3
13 changed files with 1416 additions and 18 deletions
|
@ -1,3 +1,6 @@
|
|||
import * as fs from 'fs'
|
||||
import * as io from '../../io/src/io'
|
||||
import * as path from 'path'
|
||||
import * as utils from '../src/internal-utils'
|
||||
import * as core from '@actions/core'
|
||||
import {HttpCodes} from '@actions/http-client'
|
||||
|
@ -96,4 +99,22 @@ describe('Utils', () => {
|
|||
expect(utils.isRetryableStatusCode(HttpCodes.NotFound)).toEqual(false)
|
||||
expect(utils.isRetryableStatusCode(HttpCodes.Forbidden)).toEqual(false)
|
||||
})
|
||||
|
||||
it('Test Creating Artifact Directories', async () => {
|
||||
const root = path.join(__dirname, '_temp', 'artifact-download')
|
||||
// remove directory before starting
|
||||
await io.rmRF(root)
|
||||
|
||||
const directory1 = path.join(root, 'folder2', 'folder3')
|
||||
const directory2 = path.join(directory1, 'folder1')
|
||||
|
||||
// Initially should not exist
|
||||
expect(fs.existsSync(directory1)).toEqual(false)
|
||||
expect(fs.existsSync(directory2)).toEqual(false)
|
||||
const directoryStructure = [directory1, directory2]
|
||||
await utils.createDirectoriesForArtifact(directoryStructure)
|
||||
// directories should now be created
|
||||
expect(fs.existsSync(directory1)).toEqual(true)
|
||||
expect(fs.existsSync(directory2)).toEqual(true)
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue