- differentiate full match vs no match by checking the regex match when filling the placeholders

- This means that transforms which don't match to function as before, but also offers the flexibility if a match results in the equal content as the original to be handled properly
   - FIX https://github.com/mikepenz/release-changelog-builder-action/issues/929
This commit is contained in:
Mike Penz
2022-10-19 17:29:01 +02:00
parent b1d24502f1
commit 727fe7d827
+1 -1
View File
@@ -337,7 +337,7 @@ function replacePlaceholders(
if (transformer?.pattern) {
const extractedValue = value.replace(transformer.pattern, transformer.target)
// note: `.replace` will return the full string again if there was no match
if (extractedValue && extractedValue !== value) {
if (extractedValue && (extractedValue !== value || (extractedValue === value && value.match(transformer.pattern)))) {
if (placeholderPrMap) {
createOrSet(placeholderPrMap, placeholder.name, extractedValue)
}