How to Customize Commit Messages #183
Ibochkarev
announced in
Announcements
Replies: 1 comment 1 reply
-
Sorry for the delayed response. However, it can be completed with full custom configuration:
commitlint.config.cjs const { execSync } = require('node:child_process')
const issue = execSync('git rev-parse --abbrev-ref HEAD')
.toString()
.trim()
.split('_')?.[1] || '0'
const mapping = (type) => {
const removeAnsi = type.replace(/\x1b\[[0-9;]*m/g, '')
return {
feat: 'functionality',
}[removeAnsi]
}
const pusher = execSync('git config user.name || true').toString().trim()
/** @type {import('czg').UserConfig} */
module.exports = {
prompt: {
scopes: ['infrastructure'],
customScopesAlign: 'bottom',
skipQuestions: ['body', 'breaking'],
allowCustomIssuePrefix: false,
allowEmptyIssuePrefix: false,
issuePrefixes: ['by'],
defaultIssues: pusher,
messages: {
footer: 'The author of this commit is:\n',
},
formatMessageCB: ({ type, scope, subject, footer }) => {
// console.log(type)
return `${type}(${scope}) ${mapping(type)}: [PREMPROD-${issue}] ${subject} by ${footer.trim()}`
},
},
} Using |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
💭 Describe the feature
Thanks for the development of the project!
I need to add the branch name to the commit name. Is it possible to automate the process of inserting a branch name into a commit by introducing a new parameter.
Example of a commit name after adding
feat(infrastructure) functionality: [PREMPROD-30287] Refine git branch detection by mask
Thanks in advance!
💡 Proposed Solution
No response
Beta Was this translation helpful? Give feedback.
All reactions