mirror of
https://github.com/tschoffelen/gha.git
synced 2024-10-05 21:38:21 +03:00
Added warning if the value of a secret is missing
This commit is contained in:
parent
d8303412eb
commit
49642105e8
19
lib/utils.js
19
lib/utils.js
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user