Question: Ticket initial value on cli for ticket with numbers and characters
Jrgsto opened this issue Β· comments
We are using clickup and our branch name are structured as:
CU-863gvp799_Run-tests-only-if-not-PR-in-draft
When moving through the flow it wont pre-populate the ticket correctly and seems to cut off after the last number:
If there is no configuration that will cover this, I am happy to contribute.
My config:
{
"check_status": true,
"commit_type": {
"enable": true,
"initial_value": "feat",
"infer_type_from_branch": true,
"append_emoji_to_label": false,
"append_emoji_to_commit": false,
"options": [
{
"value": "hotfix",
"label": "hotfix",
"hint": "Hotfixing any critical bug",
"emoji": "π¨"
},
{
"value": "feat",
"label": "feat",
"hint": "A new feature",
"emoji": "β¨"
},
{
"value": "fix",
"label": "fix",
"hint": "A bug fix",
"emoji": "π"
},
{
"value": "docs",
"label": "docs",
"hint": "Documentation only changes",
"emoji": "π"
},
{
"value": "refactor",
"label": "refactor",
"hint": "A code change that neither fixes a bug nor adds a feature",
"emoji": "π¨"
},
{
"value": "perf",
"label": "perf",
"hint": "A code change that improves performance",
"emoji": "π"
},
{
"value": "test",
"label": "test",
"hint": "Adding missing tests or correcting existing tests",
"emoji": "π¨"
},
{
"value": "build",
"label": "build",
"hint": "Changes that affect the build system or external dependencies",
"emoji": "π§"
},
{
"value": "ci",
"label": "ci",
"hint": "Changes to our CI configuration files and scripts",
"emoji": "π€"
},
{
"value": "chore",
"label": "chore",
"hint": "Other changes that do not modify src or test files",
"emoji": "π§Ή"
},
{
"value": "",
"label": "none"
}
]
},
"commit_scope": {
"enable": true,
"custom_scope": false,
"initial_value": "app",
"options": [
{
"value": "app",
"label": "app"
},
{
"value": "config",
"label": "config"
},
{
"value": "tools",
"label": "tools"
},
{
"value": "infrastructure",
"label": "infrastructure"
},
{
"value": "",
"label": "none"
}
]
},
"check_ticket": {
"infer_ticket": true,
"confirm_ticket": true,
"add_to_title": true,
"append_hashtag": false,
"title_position": "start"
},
"commit_title": {
"max_size": 70
},
"commit_body": {
"enable": true,
"required": false
},
"commit_footer": {
"enable": true,
"initial_value": [],
"options": [
"deprecated",
"closes",
"breaking-change",
"custom"
]
},
"breaking_change": {
"add_exclamation_to_title": true
},
"confirm_commit": true,
"print_commit_output": true,
"branch_pre_commands": [],
"branch_post_commands": [],
"branch_user": {
"enable": false,
"required": false,
"separator": "/"
},
"branch_type": {
"enable": false,
"separator": "/"
},
"branch_ticket": {
"enable": true,
"required": false,
"separator": "_"
},
"branch_description": {
"max_length": 70
}
}
@Jrgsto Hey there, I'm working rn so I just wrote something really quickly. If you could test it for me that would be great.
It's on this branch, running locally is pretty easy: everduin/fix/44-infer-underscore
clone as per usual, checkout my branch, run npm install
, make some changes in the repository, run npm run start
I'm not familiar with clickup but I was assuming the format will always start with a tag such as CU-
. I made the selector very specific because looking for letters OR numbers tends to match everything.
So this is specifically a selector for capital letters, followed by a dash, followed by letters or numbers, followed by an underscore. And just like all of the other inference, it must be at the start of the branch or after a /
Thanks a lot! That works perfectly. Cant wait to use it.
Great work!
π This issue has been resolved in version 1.5.1 π
The release is available on:
Your semantic-release bot π¦π
@Jrgsto -- No problem, thanks :)
You should be able to npm update to better-commits@1.5.1
now