This commit is contained in:
Konrad Pabjan 2020-02-20 15:48:03 -05:00
parent 18f0f591fb
commit 6ced765a9f
12 changed files with 4792 additions and 4 deletions

4
src/constants.ts Normal file
View file

@ -0,0 +1,4 @@
export enum Inputs {
Name = 'name',
Path = 'path'
}

25
src/download-artifact.ts Normal file
View file

@ -0,0 +1,25 @@
import * as core from '@actions/core'
import * as artifact from '@actions/artifact'
import {Inputs} from './constants'
async function run(): Promise<void> {
try {
const name = core.getInput(Inputs.Name, {required: false})
const path = core.getInput(Inputs.Path, {required: false})
const artifactClient = artifact.create()
if (!name) {
// download all artifacts
await artifactClient.downloadAllArtifacts(path)
} else {
// download a single artifact
await artifactClient.downloadArtifact(name, path, {
createArtifactFolder: false
})
}
} catch (err) {
core.setFailed(err.message)
}
}
run()