Creating labels for GitHub issue system

Simple script to automate creation

I liked the ideas for Managing your backlog with GitHub Issues and the type of labels used but creating them was harder than it should have been because of the unicode characters and custom colors and so using them consistently on multiple projects would mean repeating the same work each time (unless there is a ‘copy labels’ button that I haven’t noticed!).

So, I decided to write a little script to automate the process. It creates a slightly different set of labels as shown below but could be easily adapted to your own needs:

You need to add curl to your path or put it in the same folder as the script which prompts you for your GitHub Profile, Password and Project name.

The actual script (save as a cmd file):

@echo off
echo This script creates issue labels for a GitHub repository
echo Please specify the GitHub Profile containing the Repository, e.g.:
echo                    ~~~~~~~~~
set /P username= "  Enter Profile   : "
echo Please specify the GitHub password for that profile:
set /P password= "  Enter Password  : "
echo Please specify the GitHub Repository, e.g.:
echo                              ~~~~~~~~~~~~~
set /P repository= "  Enter Repository: "
echo Creating labels ...
curl -k -u "%username%:%password%" -d "{\"name\":\"Feature\",\"color\":\"2d9e11\"}"
curl -k -u "%username%:%password%" -d "{\"name\":\"Bug\",\"color\":\"e10c02\"}"
curl -k -u "%username%:%password%" -d "{\"name\":\"Rejected\",\"color\":\"000000\"}"
curl -k -u "%username%:%password%" -d "{\"name\":\"Idea\",\"color\":\"e102d8\"}"
curl -k -u "%username%:%password%" -d "{\"name\":\"Task\",\"color\":\"0b02e1\"}"
curl -k -u "%username%:%password%" -d "{\"name\":\"\u2605\",\"color\":\"fffdd6\"}"
curl -k -u "%username%:%password%" -d "{\"name\":\"\u2605\u2605\",\"color\":\"fff875\"}"
curl -k -u "%username%:%password%" -d "{\"name\":\"\u2605\u2605\u2605\",\"color\":\"fff200\"}"
echo Current labels ...
curl -k -u "%username%:%password%"

Feb 2013: Script updated to work with latest Curl for Windows that I tried on Windows 8