release-changelog-builder-action: Looks like duplicate_filter is not being recognized in config

Hello,

I’m trying to setup duplicate_filter to strip duplicates from the PR list that the Builder retrieves.

Lets say my PR list looks like this:

TEST-123: First awesome PR
TEST-123: Another awesome PR

In the result I am stripping the message and leaving only TEST-XXX using transform:

    "transformers": [
      {
        "pattern": "((?:TEST|Test))[ -](\\b\\d{3,4}\\b).*",
        "target": "$1-$2 - "
      }
    ]

To remove duplicates I added duplicate_filter:

    "duplicate_filter": {
      "pattern": "(?:(?:TEST|Test))[-](?:\\b\\d{3,4}\\b)",
      "on_property": "title",
      "method": "match"
    }

But I am still getting:

TEST-123
TEST-123

I looked at the implementation and I see that it should do the deduplication before applying transform:

    if (config.duplicate_filter !== undefined) {
        const extractor = validateTransformer(config.duplicate_filter);
        if (extractor != null) {
            core.info(`ℹ️ Remove duplicated pull requests using \`duplicate_filter\``);
            const deduplicatedMap = new Map();
            const unmatched = [];
            for (const pr of prs) {
                const extracted = extractValues(pr, extractor, 'dupliate_filter');
                if (extracted !== null && extracted.length > 0) {
                    deduplicatedMap.set(extracted[0], pr);
                }
                else {
                    core.info(`  PR (${pr.number}) did not resolve an ID using the \`duplicate_filter\``);
                    unmatched.push(pr);
                }
            }
            const deduplicatedPRs = Array.from(deduplicatedMap.values());
            deduplicatedPRs.push(...unmatched); // add all unmatched PRs to map
            const removedElements = prs.length - deduplicatedPRs.length;
            core.info(`ℹ️ Removed ${removedElements} pull requests during deduplication`);
            prs = (0, pullRequests_1.sortPullRequests)(deduplicatedPRs, sortAsc); // resort deduplicatedPRs
        }
        else {
            core.warning(`⚠️ Configured \`duplicate_filter\` invalid.`);
        }
    }

An in my GH action I see: obraz So it looks like it’s not even picking up the duplicate_filter section since it’s not outputing any messages that are defined inside the top most if?

Any ideas?

Thanks in advance 😃

Kind regards, Michal

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 24 (13 by maintainers)

Most upvoted comments

@MichalWasowskiMeniga I sadly haven’t had the chance yet to look further into it, between Google IO and work. I hope I may be able to spend some time with it tomorrow