diff --git a/.github/workflows/buildScripts/replaceTokens.js b/.github/workflows/buildScripts/replaceTokens.js index 0cb1e8a..9872bcb 100644 --- a/.github/workflows/buildScripts/replaceTokens.js +++ b/.github/workflows/buildScripts/replaceTokens.js @@ -18,13 +18,18 @@ module.exports = async ({ github, context, core, jobId }) => { while (match = regex.exec(data)) { const token = match[1].replace(/-/g, '_').toUpperCase(); console.log(token); - const value = getValue(token); + const value = getValue(token, jobId); console.log(value); + if (!value) { + core.setFailed(`Token ${token} not found`); + return false; + } } }); } -function getValue(token) { +function getValue(token, jobId) { + if (token == 'BUILDID') { return jobId; } const secrets = JSON.parse(process.env.SECRETS); const variables = JSON.parse(process.env.VARIABLES); return variables[token] || secrets[token];