Added warning if the value of a secret is missing

This commit is contained in:
Thomas Schoffelen 2018-12-31 19:47:59 +01:00
parent d8303412eb
commit 49642105e8
No known key found for this signature in database
GPG Key ID: 03F5C979F442A38D

View File

@ -119,6 +119,17 @@ const runAction = (actionTitle, actions, event, verbose) => {
err(`Invalid 'uses' key for this action`)
}
action.env = Object.assign(defaultEnv(action, event), 'env' in action && action.env ? action.env : {})
if ('secrets' in action && action.secrets && typeof action.secrets === 'object') {
action.secrets.forEach(secret => {
if (secret in process.env) {
action.env[secret] = process.env[secret]
} else if (!(secret in action.env)) {
console.log(chalk.yellow(`WARN No value specified for secret ${secret}`))
}
})
}
const uses = action.uses
const imageName = resolveRunner(uses, verbose)
let args = []
@ -127,14 +138,6 @@ const runAction = (actionTitle, actions, event, verbose) => {
args.push(`--entrypoint "${action.runs.replace(/"/g, '\"')}"`)
}
action.env = Object.assign(defaultEnv(action, event), 'env' in action && action.env ? action.env : {})
if ('secrets' in action && action.secrets && typeof action.secrets === 'object') {
action.secrets.forEach(secret => {
if (secret in process.env) {
action.env[secret] = process.env[secret]
}
})
}
for (const title in action.env) {
if (!action.env.hasOwnProperty(title)) {
continue