Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't add a custom prefix that has space in it e.g BREAKING CHANGE #257

Open
pof-jhansilva opened this issue Feb 14, 2024 · 3 comments
Open

Comments

@pof-jhansilva
Copy link

Is your feature request related to a problem? Please describe.

Hey, so we are using semantic-release to create our Github Releases using the following prefix table

image

I wanted to add BREAKING CHANGE: as a valid prefix because semantic-release uses it to create major/breaking releases but when I try it it just errors out.

Example of configuration:

- name: Validate semantic title 🔡
        uses: amannn/action-semantic-pull-request@v5
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          types: |
            fix
            feat
            perf
            BREAKING CHANGE

But even after adding that it still errors out with:

Error: No release type found in pull request title "BREAKING CHANGE". Add a prefix to indicate what kind of release this pull request corresponds to. For reference, see https://www.conventionalcommits.org/

Available types:
 - fix
 - feat
 - perf
 - BREAKING CHANGE
 

Describe the solution you'd like

Be able to add BREAKING CHANGE as an acceptable prefix so we can use it together with this action

Describe alternatives you've considered

Using perf prefix that is accepted by the conventionalcommits but sometimes this doesn't reflect the type of change that we are introducing.

@amannn
Copy link
Owner

amannn commented Feb 15, 2024

Hmm, interesting. If you'd be interested in analyzing this and potentially setting up a PR, I'd be happy to review it. The only thing we document is that the types need to be newline-delimited:

          # Configure which types are allowed (newline-delimited).
          # Default: https://github.com/commitizen/conventional-commit-types
          types: |
            fix
            feat

This is the corresponding parsing logic:

const ENUM_SPLIT_REGEX = /\n/;
module.exports = {
parseEnum(input) {
return input
.split(ENUM_SPLIT_REGEX)
.map((part) => part.trim())
.filter((part) => part.length > 0);
},

As an alternative, you can use the exclamation mark syntax that is used by Conventional Commits to indicate breaking changes (see the readme).

@lwhiteley
Copy link

isnt the BREAKING CHANGE prefix suppose to be in the body/description of the PR?

according to conventional commits, a subject line specifies a breaking change by using !

for eg:

chore!: change behaviour of xyz

OR

feat(api)!: send an email to the customer when a product is shipped

Ref:

BREAKING CHANGE: a commit that has a footer BREAKING CHANGE:, or appends a ! after the type/scope, introduces a breaking API change (correlating with MAJOR in Semantic Versioning). A BREAKING CHANGE can be part of commits of any type.

https://www.conventionalcommits.org/en/v1.0.0/#summary

@pof-jhansilva
Copy link
Author

Yes, @lwhiteley I think the issue is still valid because this tool won't accept anything that have space as a valid semantic PR title (Even if you customize them to be what you want).

At the end we where able to workaround this issue by doing a feat: but adding BREAKING CHANGE to the commit footer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants