-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.js
28 lines (22 loc) · 854 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const core = require('@actions/core')
const DownloadArtifact = require('./lib/download-artifact')
async function run() {
try {
const name = core.getInput('name', {required: true})
const path = core.getInput('path', {required: false})
const token = core.getInput('token', {required: true})
const downloadArtifact = new DownloadArtifact(token, path)
downloadArtifact.init()
core.info(`Looking for an artifact '${name}'...`)
const artifactId = await downloadArtifact.getLastArtifactIdByName(name)
if (!artifactId) {
core.setFailed('no artifacts found')
return
}
core.info(`Started downloading ${artifactId}`)
await downloadArtifact.downloadArtifact(artifactId)
} catch (error) {
core.setFailed(error.message)
}
}
run()