GeezerVison is showing github.com — update to node24 and allow quotes · codeurs/secrets-replace@35aea07
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: action.yml +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
|
9 | 9 | description: "Secrets object (JSON type)" |
10 | 10 | required: true |
11 | 11 | runs: |
12 | | - using: "node20" |
| 12 | + using: "node24" |
13 | 13 | main: "index.js" |
Collapse file
Copy file name to clipboardExpand all lines: index.js +5-5Lines changed: 5 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -19,15 +19,15 @@ try { |
19 | 19 | return b.length > a.length |
20 | 20 | }) |
21 | 21 | for (let key of sortedKeys) { |
22 | | - const reg = new RegExp(String.raw`=SECRET_${key}\b`, 'gim') |
23 | | - result = result.replace(reg, '=' + secrets[key]) |
| 22 | + const reg = new RegExp(String.raw`=(['"]?)SECRET_${key}(['"]?)\b`, 'gim') |
| 23 | + result = result.replace(reg, `=$1${secrets[key]}$2`) |
24 | 24 | } |
25 | | - const matches = result.matchAll(/=SECRET_.+?\b/g) |
| 25 | + const matches = result.matchAll(/=['"]?SECRET_.+?['"]?\b/g) |
26 | 26 | const warnings = [] |
27 | | - for (m of matches) { |
| 27 | + for (const m of matches) { |
28 | 28 | if (warnings.indexOf(m[0]) >= 0) continue |
29 | 29 | warnings.push(m[0]) |
30 | | - console.warn("Warning: Key not found. "+ m[0].substr(1)) |
| 30 | + console.warn("Warning: Key not found. "+ m[0].substring(1)) |
31 | 31 | } |
32 | 32 | fs.writeFile(file, result, function (writeError) { |
33 | 33 | if (writeError) { |
|