amannn / action-semantic-pull-request

A GitHub Action that ensures that your PR title matches the Conventional Commits spec
MIT License
957 stars 120 forks source link

Custom types not matching as expected #260

Open Indemnity83 opened 5 months ago

Indemnity83 commented 5 months ago

Describe the bug

I defined custom types that include an emoji, but when I run the action the validation fails even though the PR title uses one of the type options and it is unclear why the workflow doesn't think it matches.

To reproduce

Setup custom types with emoji's:

with:
  types: |
    โœจ feat
    ๐Ÿ› fix
    ๐Ÿ“ docs
    ๐Ÿ’Ž style
    โ™ป๏ธ refactor
    ๐Ÿ“ˆ perf
    ๐Ÿงช test
    ๐Ÿ—๏ธ build
    ๐Ÿ“ฆ ci
    ๐Ÿงน chore
    โช๏ธ revert

Generate a PR with one of these types in the title "๐Ÿ“ฆ ci: run tests"

Expected behavior

I'd expect this to pass validation, but it fails with the following message:

No release type found in pull request title "๐Ÿ“ฆ ci: run tests". Add a prefix to indicate what kind of release this pull request corresponds to. For reference, see https://www.conventionalcommits.org/

Available types:
 - โœจ feat
 - ๐Ÿ› fix
 - ๐Ÿ“ docs
 - ๐Ÿ’Ž style
 - โ™ป๏ธ refactor
 - ๐Ÿ“ˆ perf
 - ๐Ÿงช test
 - ๐Ÿ—๏ธ build
 - ๐Ÿ“ฆ ci
 - ๐Ÿงน chore
 - โช๏ธ revert
amannn commented 5 months ago

This might be a duplicate of https://github.com/amannn/action-semantic-pull-request/issues/257

Indemnity83 commented 5 months ago

Digging a bit deeper, it looks like an issue with the regex used by conventional-commit-parser. It expects a single word.

/^(\w)(?:(([\w\$.-* ])))?\: (.*)$/

That library also appears to be 8 years without an update so not much point in trying to fix that.

Possibly, would need to replace that library with something like https://commitlint.js.org/api/lint

amannn commented 5 months ago

That library also appears to be 8 years without an update so not much point in trying to fix that.

conventional-commits-parser? It looks actively maintained to me, no?

buglavecz commented 4 months ago

Hi. The latest version 6.0.0, but you used the 3.2.x version. I have a same problem, i try use gitmoji icons before commit types, but I try header regexp config change, it is doesn't works.