Merge branch 'SkySails-fix/cleanup-custom-ph-from-pr-template' into develop

This commit is contained in:
Mike Penz
2022-08-16 16:52:31 +02:00
4 changed files with 22 additions and 6 deletions
+19 -3
View File
@@ -597,11 +597,27 @@ it('Extract custom placeholder from PR body and replace in global template', asy
pattern: '.+ b(....).+', pattern: '.+ b(....).+',
target: '\n- $1' target: '\n- $1'
} }
},
{
name: 'C_PLACEHOLER_3',
source: 'BODY',
transformer: {
pattern: '.+(body1).+',
target: '$1'
}
},
{
name: 'C_PLACEHOLER_4',
source: 'BODY',
transformer: {
pattern: '.+(body-never-matches).+',
target: '$1'
}
} }
] ]
customConfig.template = customConfig.template =
'${{CHANGELOG}}\n\n${{C_PLACEHOLER_2[2]}}\n\n${{C_PLACEHOLER_2[*]}}${{C_PLACEHOLDER_1[7]}}${{C_PLACEHOLER_2[1493]}}' '${{CHANGELOG}}\n\n${{C_PLACEHOLER_2[2]}}\n\n${{C_PLACEHOLER_2[*]}}${{C_PLACEHOLDER_1[7]}}${{C_PLACEHOLER_2[1493]}}${{C_PLACEHOLER_4[*]}}${{C_PLACEHOLER_4[0]}}${{C_PLACEHOLER_3[1]}}'
customConfig.pr_template = '${{BODY}} ----> ${{C_PLACEHOLDER_1}}' customConfig.pr_template = '${{BODY}} ----> ${{C_PLACEHOLDER_1}}${{C_PLACEHOLER_3}}'
const resultChangelog = buildChangelog(DefaultDiffInfo, mergedPullRequests, { const resultChangelog = buildChangelog(DefaultDiffInfo, mergedPullRequests, {
owner: 'mikepenz', owner: 'mikepenz',
@@ -617,6 +633,6 @@ it('Extract custom placeholder from PR body and replace in global template', asy
}) })
expect(resultChangelog).toStrictEqual( expect(resultChangelog).toStrictEqual(
`## 🚀 Features\n\nno magic body1 for this matter ----> - body1\nno magic body3 for this matter ----> - body3\n\n## 🐛 Fixes\n\nno magic body2 for this matter ----> - body2\nno magic body3 for this matter ----> - body3\n\n## 🧪 Others\n\nno magic body4 for this matter ----> - body4\n\n\n\n\n- ody3\n\n\n- ody1\n- ody2\n- ody3\n- ody4` `## 🚀 Features\n\nno magic body1 for this matter ----> - body1body1\nno magic body3 for this matter ----> - body3\n\n## 🐛 Fixes\n\nno magic body2 for this matter ----> - body2\nno magic body3 for this matter ----> - body3\n\n## 🧪 Others\n\nno magic body4 for this matter ----> - body4\n\n\n\n\n- ody3\n\n\n- ody1\n- ody2\n- ody3\n- ody4`
) )
}) })
Generated Vendored
+1 -1
View File
@@ -1756,7 +1756,7 @@ function cleanupPrPlaceHolders(template, placeholders /* placeholders to apply *
let transformed = template; let transformed = template;
for (const [, phs] of placeholders) { for (const [, phs] of placeholders) {
for (const ph of phs) { for (const ph of phs) {
transformed = transformed.replaceAll(new RegExp(`\\$\\{\\{${ph.name}\\[.+?\\]\\}\\}`, 'gu'), ''); transformed = transformed.replaceAll(new RegExp(`\\$\\{\\{${ph.name}(?:\\[.+?\\])?\\}\\}`, 'gu'), '');
} }
} }
return transformed; return transformed;
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -379,7 +379,7 @@ function cleanupPrPlaceHolders(
let transformed = template let transformed = template
for (const [, phs] of placeholders) { for (const [, phs] of placeholders) {
for (const ph of phs) { for (const ph of phs) {
transformed = transformed.replaceAll(new RegExp(`\\$\\{\\{${ph.name}\\[.+?\\]\\}\\}`, 'gu'), '') transformed = transformed.replaceAll(new RegExp(`\\$\\{\\{${ph.name}(?:\\[.+?\\])?\\}\\}`, 'gu'), '')
} }
} }
return transformed return transformed