forked from ykxVK8yL5L/add-to-web3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
31 lines (28 loc) · 999 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
29
30
31
const core = require('@actions/core')
const { addToWeb3, pickName } = require('./web3')
async function run () {
try {
const filename = core.getInput('file_name')
// const name = pickName({
// repo: encodeURIComponent(filename),
// run: process.env.GITHUB_RUN_NUMBER,
// sha: process.env.GITHUB_SHA
// })
const name = pickName({
repo: filename
})
const endpoint = new URL(core.getInput('web3_api'))
const pathToAdd = core.getInput('path_to_add')
const token = core.getInput('web3_token')
const includeHidden = core.getInput('include_hidden')
const wrapWithDirectory = core.getBooleanInput('wrap_with_directory')
core.info(`Adding ${pathToAdd} to ${endpoint.origin}`)
const { cid, url } = await addToWeb3({ endpoint, token, name, pathToAdd, wrapWithDirectory, includeHidden })
core.info(url)
core.setOutput('cid', cid)
core.setOutput('url', url)
} catch (error) {
core.setFailed(error.message)
}
}
run()