mikepenz/release-changelog-builder-action

Changelog Template ignoring one particular entry

Aetherinox opened this issue ยท 9 comments

Sorry to bug ya, but this is a rather odd issue, and I can't for the life of me figure it out.

I have the following json template

{
    "categories": [
        {
            "title": "\n\n<br>\n\n#### ๐Ÿช› Continuous integration",
            "labels": [ "kind/ci", "ci" ]
        },
        {
            "title": "\n\n<br>\n\n#### ๐Ÿš€ Features",
            "labels": [ "kind/feature", "feature", "feat" ]
        },
        {
            "title": "\n\n<br>\n\n#### ๐Ÿ› Bugfixes",
            "labels": [ "kind/bug", "fix", "bug" ]
        },
        {
            "title": "\n\n<br>\n\n#### ๐Ÿ”ง Changes",
            "labels": [ "kind/chore", "change", "chore" ]
        },
        {
            "title": "\n\n<br>\n\nn#### โœจ Optimizations",
            "labels": [ "kind/perf", "optimization", "perf", "optimize" ]
        },
        {
            "title": "\n\n<br>\n\n#### ๐Ÿšจ Security ",
            "labels": [ "kind/security", "security" ]
        },
        {
            "title": "\n\n<br>\n\n#### ๐Ÿงน Housekeeping",
            "labels": [ "kind/refactor", "refactor", "style" ]
        },
        {
            "title": "\n\n<br>\n\n#### ๐Ÿ’ Miscellaneous",
            "labels": [ "kind/misc", "misc" ]
        },
        {
            "title": "\n\n<br>\n\n#### โ›” Deprecated",
            "labels": [ "kind/deprecate", "deprecate" ]
        },
        {
            "title": "\n\n<br>\n\n#### โ›” Removed",
            "labels": [ "kind/remove", "remove" ]
        },
        {
            "title": "\n\n<br>\n\n#### ๐Ÿ“ฆ Build & Dependencies",
            "labels": [ "kind/build", "build", "dependency", "dep", "package" ]
        },
        {
            "title": "\n\n<br>\n\n#### โœ๏ธ Docs",
            "labels": [ "kind/docs", "doc", "docs", "wiki" ]
        },
        {
            "title": "\n\n<br>\n\n#### ๐Ÿงช Tests & Demo Vault",
            "labels": [ "kind/test", "test", "tests", "vault" ]
        }
    ],
    "sort": "ASC",
    "pr_template": "- ${{TITLE_ONLY}} : #{{MERGE_SHA}} @#{{AUTHOR}}",
    "empty_template": "- No major changes to address in this release",
    "custom_placeholders": [
        {
          "name": "TITLE_ONLY",
          "source": "TITLE",
          "transformer": {
            "method": "regexr",
            "pattern": "(\\w+(\\(.+\\))?: ?)?(.+)",
            "target": "$2 $3"
          }
        }
      ],
    "label_extractor": [
        {
        "pattern": "^(build|ci|change|chore|doc|docs|wiki|remove|deprecate|security|dependency|dep|package|feat|feature|fix|bug|perf|optimize|optimization|refactor|style|test|tests|vault):(.*)",
        "target": "$1"
        },
        {
        "pattern": "^(build|ci|change|chore|doc|docs|wiki|remove|deprecate|security|dependency|dep|package|feat|feature|fix|bug|perf|optimize|optimization|refactor|style|test|tests|vault){1}(\\([\\w\\-\\.]+\\))?(!)?:(.*)",
        "target": "$1"
        }
    ],
    "duplicate_filter": {
        "pattern": "github.*",
        "on_property": "author",
        "method": "match"
    },
    "max_tags_to_fetch": 200,
    "max_pull_requests": 200,
    "max_back_track_time_days": 365,
    "exclude_merge_branches": [],
    "tag_resolver": {
        "method": "semver"
    },
    "base_branches": []
}

It seems to be skipping / ignoring feat. No matter what I do. I've ensured it was spelt properly, and matches in all of the rows needed. Every other entry works, but not when I tag something as:

feat: insert feature here

The commit in question had the text:
feat: add gistr-web codeblock as alternative to raw: true

Update, because I had to push some changes today, and it happened more, but this time with 3-4 items.

I noticed that it's occurring with commits that I've added additional notes to (I have commitMode enabled.)

If I push a commit with just a title, it shows in the list fine. However, if I throw in additional comments in the commit description; it doesn't show in the changelog on the releases page.

image

image

image


Second example:

image

image

image


The same is true for 2 other commits I made. They were skipped and had descriptions.

The other interesting note is that in the logs, it seems to think they are uncategorized, even though they follow the exact same commit standards that the working ones did.

  โ„น๏ธ Removed 0 pull requests during deduplication
  โ„น๏ธ Used 0 transformers to adjust message
  โœ’๏ธ Wrote messages for 11 pull requests
  โ„น๏ธ Ordered all pull requests into 13 categories
  โœ’๏ธ Wrote 7 categorized pull requests down
  โœ’๏ธ Wrote 4 non categorized pull requests down
  โœ’๏ธ Wrote 0 ignored pull requests down
  โ„น๏ธ Filled template

That's a tricky one. it could be that the regex does not match if it is multi-line. what regex flags are you setting?

Oh actually we only take the first line ๐Ÿค”

Screenshot 2024-04-10 at 14 04 11

Actually good question, are you referring to category.rules.flags? Because from what I see, I have not set these yet.

In hindsight given we trim it to only keep the first line for the summary it shouldn't matter ๐Ÿค”
unless we use the message for the title. ๐Ÿค”

Edit: we use the summary: https://github.com/mikepenz/release-changelog-builder-action/blob/develop/src/pr-collector/commits.ts#L113

So I am not sure yet.

Can you point me to the CI run so I might test it locally?

Keep in mind, my workflow has a lot of steps, so you may want to cut them down.
Workflow: https://github.com/Aetherinox/obsidian-gistr/blob/main/.github/workflows/release-npm.yml

The particular action is: https://github.com/Aetherinox/obsidian-gistr/actions/runs/8544149198/job/23409544035, which produced this release with the messed up changelog: https://github.com/Aetherinox/obsidian-gistr/releases/tag/1.6.5

For the workflow, check the step "๐Ÿ“ Changelog โ€บ Build (Categorized)", there's a step below labeled Uncategorized, which is not being used right now. The step you want can be directly accessed via https://github.com/Aetherinox/obsidian-gistr/blob/a9e515f7799385cbe4b51ba9d31f8c8a1b42828f/.github/workflows/release-npm.yml#L264

Screenshot 2024-04-11 at 15 20 35

So debugging this. message and title appear to look fine.

Looking further though, shows that given you don't specify which property to extract the label from (using the label extractor) it will automatically pick the body
Screenshot 2024-04-11 at 15 24 13

Given the body is multiple lines, the standard regex won't match now. regexes handle multi line different. I believe the m flag would change the behavior for multi line.

Anyways, the easiest solution in your case is to adjust the config to not match the lable on the body, but instead of the single line title:

E.g. change the label_extractor to:

"label_extractor": [
    {
        "pattern": "^(build|ci|change|chore|doc|docs|wiki|remove|deprecate|security|dependency|dep|package|feat|feature|fix|bug|perf|optimize|optimization|refactor|style|test|tests|vault):(.*)",
        "target": "$1",
        "on_property": "title"
    },
    {
        "pattern": "^(build|ci|change|chore|doc|docs|wiki|remove|deprecate|security|dependency|dep|package|feat|feature|fix|bug|perf|optimize|optimization|refactor|style|test|tests|vault){1}(\\([\\w\\-\\.]+\\))?(!)?:(.*)",
        "target": "$1",
        "on_property": "title"
    }
],

Please let me know if that fixed it. closing due to inactivity

Oops, sorry. I thought I replied back, but somewhere along the line, my brain died.

Yes, thank you, it worked perfectly. I can now add descriptions again to my commits.

Been using the fix for the last two weeks and not a single issue. I've got this github action running on like 7 of my repos without any issues.