How to use predefined label templates


#1

Important Notes

  • This post is based on Gogs 0.9.94.0829.

For every new repository, Gogs has one default predefined label template for you to quickly setup and use. The labels in default set is same as the default ones on GitHub.

However, we know you love customization, and just like the way that add your customized .gitignore, LICENSE and README, adding custom label templates is as easy as create a file like My Labels, put it under custom/conf/label directory and restart Gogs.

Content Format

The format of label template file is very straightforward. This is how it looks like in default template file:

#ee0701 bug
#cccccc duplicate
#84b6eb enhancement
#128a0c help wanted
#e6e6e6 invalid
#cc317c question
#ffffff wontfix

Each label occupies a line and separate color and name with an empty space.

Demo Time!

You will see a simple setup panel after you created a new repository, which you can select one of predefined label set:

Click on “Use this label set”, magic done!


:speech_balloon: Please leave comments if you have any questions or concerns about this post.


#2

[Original Post on Github: https://github.com/gogits/gogs/issues/1562#issuecomment-243610049]

I created a small (hacky) script to export issue labels and colors from
github repositories. I thought maybe someone wants todo similar, so
here’s the bash script:

#!/bin/bash
# Small bash script to extract Issue Labels & Colors from GitHub -> Gogs
# By Gregor Santner (https://gsantner.github.io)
[ -n "$1" ] && URL="$1" || URL="https://github.com/gogits/gogs/labels"
curl -s "$URL" | grep "label label-link" | cut -d "/" -f 5- | sed -r 's/%2F/\//g' | sed -r 's/%20/ /g' \
                | cut -d \" -f 1,3 | sed -e "s/\"background-color://" | cut -d ";" -f 1 | sort  \
                | awk 'BEGIN {OFS=FS=" ";} {temp=$NF; $NF = ""; sub(",$", ""); print temp, $0}'

Checking out labels of Gogs:

bash extractLabelsFromGithub.sh "https://github.com/gogits/gogs/labels"

#f7c6c7 dont send pull request 
#009800 help wanted 
#fc2929 kind/bug 
#c7def8 kind/deployment 
#c7def8 kind/documentation 
#c7def8 kind/enhancement 
#5319e7 kind/feature 
#0052cc kind/plugin 
#006b75 kind/proposal 
#e11d21 kind/security 
#eb6420 kind/third-party 
#006b75 kind/ui 
#1d76db open for pull request 
#e11d21 priority/critical 
#feffc0 priority/low 
#F5F3EB priority/maybe 
#cccccc reviewed/duplicate 
#e6e6e6 reviewed/invalid 
#ffffff reviewed/wont fix 
#ffffff reviewed/wont merge 
#0052cc status/assigned to community 
#1A3661 status/assigned to maintainer 
#fef2c0 status/await 
#fbca04 status/needs feedback 
#eb6420 status/needs reproduce 
#fef2c0 status/reported upstream 
#fad8c7 status/review later 
#0e8a16 status/reviewed 
#bfe5bf status/waits for review 

Just visit the Issues -> Labels page and pass the url as parameter.


#3

So currently there is no GUI in the admin panel to manage the label sets if I read correctly? Its a pain for admins to SSH login into the machine and add new files. What do you think about the feature to manage label sets files?


#4

I think we will have online manage features…