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

Add a configurable title-regex #345

Open
hofbi opened this issue Feb 8, 2023 · 4 comments
Open

Add a configurable title-regex #345

hofbi opened this issue Feb 8, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@hofbi
Copy link

hofbi commented Feb 8, 2023

Is your feature request related to a problem? Please describe.
I would like to have a configurable regex for the PR title

Describe the solution you'd like
Add a title-regex option similar to the body-regex

Describe alternatives you've considered

Additional context

@hofbi hofbi added the enhancement New feature or request label Feb 8, 2023
@mtfoley
Copy link
Owner

mtfoley commented Feb 8, 2023

Hi @hofbi thanks for the feature request! Could you describe in a little more detail what you mean (e.g. examples of a regex you might use, and titles it would and would not match).

@hofbi
Copy link
Author

hofbi commented Feb 9, 2023

For instance, if I want to have both an ticket id and the conventional commit pattern in the title such as ABC-123: feat: Add something. For this case, I would like to check that both ticket and conventional commit pattern are fulfilled.

Right now, I found a workaround by using https://github.com/thehanimo/pr-title-checker for checking the title and this action for the body. Since you already allow for specifying a regex for the body, I thought it might be useful to have this customization option for the title as well. If the title-regex is not specified, then you just stick to the regex you are currently using.

@mtfoley
Copy link
Owner

mtfoley commented Feb 10, 2023

@hofbi I had a feeling that might be the use case! Where I work, we use conventional commits with a ticket ID at the end of the title, so more like feat: add something (ABC-123) for your example. This action uses a library to check for conventional commits, so I've got my doubts as to whether you'd be able to use the ticket ID at the beginning of the titles without disabling that check altogether.

Would you be interested in creating PR for this feature?

@hofbi
Copy link
Author

hofbi commented Feb 10, 2023

I see, then it is probably difficult to provide a custom pattern. An alternative option that could keep the conventional commit check would be to add for instance a title-prefix-regex option (idea is again from https://github.com/thehanimo/pr-title-checker#usage). This you could first search for the prefix pattern and only pass the rest to the conventional commit check. But I am not sure if I like the approach even myself 😓

Nevermind, I just created this issue because I thought it would be easy to add. Simple workaround is just to combine this action with https://github.com/thehanimo/pr-title-checker. So if you don't want to touch the title checking, we can close this.

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

No branches or pull requests

2 participants