module.exports = async ({ github, context, core, jobId }) => { const frontendPath = `./${jobId}/frontend/diunaBI/browser/`; const files = require('fs').readdirSync(frontendPath).filter(file => file.endsWith('.js')); if (files.length === 0) { core.setFailed("Frontend JS files not found"); return false; } files = files.map(file => `${frontendPath}${file}`); files.push(`./${jobId}/webapi/appsettings.json`); files.push(`./${jobId}/webapi/client_secrets.json`); // tokens are in format #{tokenName} find all tokens and replace it with getValue(tokenName) const tokens = []; files.forEach(file => { const data = require('fs').readFileSync(file, 'utf8'); const regex = /#{(.*?)}/g; let match; while (match = regex.exec(data)) { tokens.push(match[1]); } }); console.log(tokens); } function getValue(token) { return 'TEST'; }