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:19:19 +02:00
parent e2d1295606
commit cd1cd31adf
3 changed files with 8 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{
"name": "gitea-bot",
"version": "1.0.0",
"version": "1.0.1",
"description": "Bot for managing gitea issues and projects.",
"main": "src/index.js",
"scripts": {

View File

@ -12,7 +12,9 @@ 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.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 branch = issue.title.replace(/[^a-z0-9\s]/gi, '')
.replaceAll(' ', '-')
.toLowerCase()

View File

@ -1,3 +1,7 @@
require('dotenv').config()
const package = require('../package.json')
require('./server')
console.log(`Start giteabot ${package.version}`)
require('./server')