Last active
May 23, 2016 12:51
-
-
Save u01jmg3/33abd1c176091a9bea34 to your computer and use it in GitHub Desktop.
Creating custom additional labels ('change', 'update') for a new repo using the GitHub API and cURL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:: http://www.confusedbycode.com/curl/ > curl-7.39.0-win64.zip | |
:: https://robinpowered.com/blog/best-practice-system-for-organizing-and-tagging-github-issues/ | |
@echo off | |
SETLOCAL | |
echo This script creates issue labels for a GitHub repository | |
echo. | |
echo Please specify the GitHub Profile containing the Repository, e.g.: | |
echo https://github.com/:org|:owner/:repo | |
echo ~~~ ~~~~~ | |
set /P username= " Enter GitHub Username: " | |
echo. | |
echo Please specify the GitHub password/token for that profile: | |
set /P password= " Enter Password/Token: " | |
echo. | |
echo Please specify the GitHub Repository, e.g.: | |
echo https://github.com/:org|:owner/:repo | |
echo ~~~~ | |
echo. | |
set /P repository= " Enter Repository: " | |
echo. | |
echo Deleting redundant labels... | |
curl -k -u "%username%:%password%" -X DELETE https://api.github.com/repos/%username%/%repository%/labels/duplicate | |
curl -k -u "%username%:%password%" -X DELETE https://api.github.com/repos/%username%/%repository%/labels/help+wanted | |
curl -k -u "%username%:%password%" -X DELETE https://api.github.com/repos/%username%/%repository%/labels/invalid | |
curl -k -u "%username%:%password%" -X DELETE https://api.github.com/repos/%username%/%repository%/labels/question | |
curl -k -u "%username%:%password%" -X DELETE https://api.github.com/repos/%username%/%repository%/labels/wontfix | |
echo. | |
echo Creating new labels... | |
curl -k -u "%username%:%password%" -d "{\"name\":\"angular\":\"bfd4f2\"}" https://api.github.com/repos/%username%/%repository%/labels | |
curl -k -u "%username%:%password%" -d "{\"name\":\"node\":\"bfd4f2\"}" https://api.github.com/repos/%username%/%repository%/labels | |
curl -k -u "%username%:%password%" -d "{\"name\":\"bug\":\"ee3f46\"}" https://api.github.com/repos/%username%/%repository%/labels | |
curl -k -u "%username%:%password%" -d "{\"name\":\"security\":\"ee3f46\"}" https://api.github.com/repos/%username%/%repository%/labels | |
curl -k -u "%username%:%password%" -d "{\"name\":\"production\":\"f45d43\"}" https://api.github.com/repos/%username%/%repository%/labels | |
curl -k -u "%username%:%password%" -d "{\"name\":\"chore\":\"fef2c0\"}" https://api.github.com/repos/%username%/%repository%/labels | |
curl -k -u "%username%:%password%" -d "{\"name\":\"legal\":\"fef2c0\"}" https://api.github.com/repos/%username%/%repository%/labels | |
curl -k -u "%username%:%password%" -d "{\"name\":\"copy\":\"ffc274\"}" https://api.github.com/repos/%username%/%repository%/labels | |
curl -k -u "%username%:%password%" -d "{\"name\":\"design\":\"ffc274\"}" https://api.github.com/repos/%username%/%repository%/labels | |
curl -k -u "%username%:%password%" -d "{\"name\":\"ux\":\"ffc274\"}" https://api.github.com/repos/%username%/%repository%/labels | |
curl -k -u "%username%:%password%" -d "{\"name\":\"staging\":\"fad8c7\"}" https://api.github.com/repos/%username%/%repository%/labels | |
curl -k -u "%username%:%password%" -d "{\"name\":\"test\":\"fad8c7\"}" https://api.github.com/repos/%username%/%repository%/labels | |
curl -k -u "%username%:%password%" -d "{\"name\":\"discussion\":\"cc317c\"}" https://api.github.com/repos/%username%/%repository%/labels | |
curl -k -u "%username%:%password%" -d "{\"name\":\"rfc\":\"cc317c\"}" https://api.github.com/repos/%username%/%repository%/labels | |
curl -k -u "%username%:%password%" -d "{\"name\":\"question\":\"cc317c\"}" https://api.github.com/repos/%username%/%repository%/labels | |
curl -k -u "%username%:%password%" -d "{\"name\":\"enhancement\":\"5ebeff\"}" https://api.github.com/repos/%username%/%repository%/labels | |
curl -k -u "%username%:%password%" -d "{\"name\":\"optimisation\":\"5ebeff\"}" https://api.github.com/repos/%username%/%repository%/labels | |
curl -k -u "%username%:%password%" -d "{\"name\":\"feature\":\"91ca55\"}" https://api.github.com/repos/%username%/%repository%/labels | |
curl -k -u "%username%:%password%" -d "{\"name\":\"in progress\":\"fbca04\"}" https://api.github.com/repos/%username%/%repository%/labels | |
curl -k -u "%username%:%password%" -d "{\"name\":\"watchlist\":\"fbca04\"}" https://api.github.com/repos/%username%/%repository%/labels | |
curl -k -u "%username%:%password%" -d "{\"name\":\"invalid\":\"d2dae1\"}" https://api.github.com/repos/%username%/%repository%/labels | |
curl -k -u "%username%:%password%" -d "{\"name\":\"wontfix\":\"d2dae1\"}" https://api.github.com/repos/%username%/%repository%/labels | |
curl -k -u "%username%:%password%" -d "{\"name\":\"duplicate\":\"d2dae1\"}" https://api.github.com/repos/%username%/%repository%/labels | |
curl -k -u "%username%:%password%" -d "{\"name\":\"on hold\":\"d2dae1\"}" https://api.github.com/repos/%username%/%repository%/labels | |
echo. | |
echo Current labels... | |
curl -k -u "%username%:%password%" https://api.github.com/repos/%username%/%repository%/labels | |
ENDLOCAL | |
pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment