Skip to content

Commit

Permalink
chore: use replaceAll instead of global regex to redact simple string (
Browse files Browse the repository at this point in the history
  • Loading branch information
wraithgar authored Apr 25, 2023
1 parent a558bbd commit 0783cff
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion scripts/create-node-pr.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,5 +280,5 @@ const main = async (spec, branch = 'main', opts) => withTempDir(CWD, async (tmpD
})

run(({ argv, ...opts }) => main(argv.remain[0], argv.remain[1], opts), {
redact: new RegExp(process.env.GITHUB_TOKEN, 'g'),
redact: process.env.GITHUB_TOKEN,
})
2 changes: 1 addition & 1 deletion scripts/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ const run = async (main, { redact } = {}) => {
process.on('log', (l, ...args) => {
if (argv.debug || process.env.CI || defaultLevels.includes(l)) {
for (const line of formatWithOptions({ colors: true }, ...args).split('\n')) {
const redacted = redact ? line.replace(redact, '***') : line
const redacted = redact ? line.replaceAll(redact, '***') : line
// eslint-disable-next-line no-console
console.error(l.slice(0, 4).toUpperCase(), redacted)
}
Expand Down

0 comments on commit 0783cff

Please sign in to comment.