Merge branch 'SkySails-fix/cleanup-custom-ph-from-pr-template' into develop
This commit is contained in:
@@ -597,11 +597,27 @@ it('Extract custom placeholder from PR body and replace in global template', asy
|
||||
pattern: '.+ b(....).+',
|
||||
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 =
|
||||
'${{CHANGELOG}}\n\n${{C_PLACEHOLER_2[2]}}\n\n${{C_PLACEHOLER_2[*]}}${{C_PLACEHOLDER_1[7]}}${{C_PLACEHOLER_2[1493]}}'
|
||||
customConfig.pr_template = '${{BODY}} ----> ${{C_PLACEHOLDER_1}}'
|
||||
'${{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}}${{C_PLACEHOLER_3}}'
|
||||
|
||||
const resultChangelog = buildChangelog(DefaultDiffInfo, mergedPullRequests, {
|
||||
owner: 'mikepenz',
|
||||
@@ -617,6 +633,6 @@ it('Extract custom placeholder from PR body and replace in global template', asy
|
||||
})
|
||||
|
||||
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`
|
||||
)
|
||||
})
|
||||
|
||||
+1
-1
@@ -1756,7 +1756,7 @@ function cleanupPrPlaceHolders(template, placeholders /* placeholders to apply *
|
||||
let transformed = template;
|
||||
for (const [, phs] of placeholders) {
|
||||
for (const ph of phs) {
|
||||
transformed = transformed.replaceAll(new RegExp(`\\$\\{\\{${ph.name}\\[.+?\\]\\}\\}`, 'gu'), '');
|
||||
transformed = transformed.replaceAll(new RegExp(`\\$\\{\\{${ph.name}(?:\\[.+?\\])?\\}\\}`, 'gu'), '');
|
||||
}
|
||||
}
|
||||
return transformed;
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
@@ -379,7 +379,7 @@ function cleanupPrPlaceHolders(
|
||||
let transformed = template
|
||||
for (const [, phs] of placeholders) {
|
||||
for (const ph of phs) {
|
||||
transformed = transformed.replaceAll(new RegExp(`\\$\\{\\{${ph.name}\\[.+?\\]\\}\\}`, 'gu'), '')
|
||||
transformed = transformed.replaceAll(new RegExp(`\\$\\{\\{${ph.name}(?:\\[.+?\\])?\\}\\}`, 'gu'), '')
|
||||
}
|
||||
}
|
||||
return transformed
|
||||
|
||||
Reference in New Issue
Block a user