mirror of
https://github.com/actions/download-artifact.git
synced 2025-07-27 08:58:28 +02:00
V2 Setup
This commit is contained in:
parent
18f0f591fb
commit
6ced765a9f
12 changed files with 4792 additions and 4 deletions
4
src/constants.ts
Normal file
4
src/constants.ts
Normal file
|
@ -0,0 +1,4 @@
|
|||
export enum Inputs {
|
||||
Name = 'name',
|
||||
Path = 'path'
|
||||
}
|
25
src/download-artifact.ts
Normal file
25
src/download-artifact.ts
Normal 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()
|
Loading…
Add table
Add a link
Reference in a new issue