Use type label as prefix if not, use feature/bugfix
nclazz/gitea-bot/pipeline/head This commit looks good Details

master
Niclas Thobaben 2023-05-27 15:22:57 +02:00
parent bb2c041284
commit 308e83f408
1 changed files with 1 additions and 4 deletions

View File

@ -11,10 +11,7 @@ module.exports = {
}
const { issue, repository } = req.body
const isBug = issue.labels.length && !!issue.labels.find(label => label.name.includes('bug'))
const typePrefix = issue.labels.length && issue.labels.find(label => label.name.startsWith('type'))
console.log(`Found type prefix`, typePrefix)
const prefix = (typePrefix ? typePrefix : isBug ? 'bugfix' : 'feature').replaceAll(/[^a-z0-9\s]/gi, '')
console.log(`Create branch prefix`, prefix)
const prefix = isBug ? 'bugfix' : 'feature'
const branch = issue.title.replace(/[^a-z0-9\s]/gi, '')
.replaceAll(' ', '-')
.toLowerCase()