Skip to content

Commit 0783cff

Browse files
authored
chore: use replaceAll instead of global regex to redact simple string (#6396)
1 parent a558bbd commit 0783cff

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

scripts/create-node-pr.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,5 +280,5 @@ const main = async (spec, branch = 'main', opts) => withTempDir(CWD, async (tmpD
280280
})
281281

282282
run(({ argv, ...opts }) => main(argv.remain[0], argv.remain[1], opts), {
283-
redact: new RegExp(process.env.GITHUB_TOKEN, 'g'),
283+
redact: process.env.GITHUB_TOKEN,
284284
})

scripts/util.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ const run = async (main, { redact } = {}) => {
149149
process.on('log', (l, ...args) => {
150150
if (argv.debug || process.env.CI || defaultLevels.includes(l)) {
151151
for (const line of formatWithOptions({ colors: true }, ...args).split('\n')) {
152-
const redacted = redact ? line.replace(redact, '***') : line
152+
const redacted = redact ? line.replaceAll(redact, '***') : line
153153
// eslint-disable-next-line no-console
154154
console.error(l.slice(0, 4).toUpperCase(), redacted)
155155
}

0 commit comments

Comments
 (0)