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

Use regex group value in commit_parsers #145

Closed
erwinc1 opened this issue Mar 9, 2023 · 1 comment
Closed

Use regex group value in commit_parsers #145

erwinc1 opened this issue Mar 9, 2023 · 1 comment
Assignees
Labels
feature/request New feature or request

Comments

@erwinc1
Copy link

erwinc1 commented Mar 9, 2023

In commit_preprocessors we can specify a regex pattern and use the value of the group in the replace field.

Excample:

commit_preprocessors = [
     { pattern = '.*#([0-9]+)', replace = "([#${0}](https://dev.azure.com/raboweb/Skunk%20Works/_backlogs/backlog/MyTeam/Backlog%20items/?workitem=${1}))"},
]

Is it possible to do the same for commit_parsers?

commit_parsers = [
    { message = ".*(#[0-9]+)", group = '${1}', default_scope = "other"},
]

This renders ${1} in the output

@erwinc1 erwinc1 changed the title Use regex group value in commit_parsers Use regex group value in commit_parsers Mar 9, 2023
@orhun orhun added the feature/request New feature or request label Apr 2, 2023
@orhun
Copy link
Owner

orhun commented Apr 2, 2023

Hello @erwinc1, thanks for reporting this! 🐻

This is now implemented in 7767ace it will be available with the upcoming release.

You can use it as follows:

# regex for parsing and grouping commits
commit_parsers = [
    { message = '^fix\((.*)\)', group = 'Fix (${1})' },
    { message = '^feat\((.*)\)', group = 'Feat (${1})' },
]

Results in:

## [1.0.0] - 2021-07-18

### Feat (parser)

- Add ability to parse arrays

### Fix (args)

- Rename help argument due to conflict

@orhun orhun added good first issue Good for newcomers and removed good first issue Good for newcomers labels Oct 10, 2023
@orhun orhun closed this as completed Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants