Last active
February 16, 2016 19:29
-
-
Save zot24/0cbbd3ee4b22123cb62a to your computer and use it in GitHub Desktop.
This file contains 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
<?php | |
// credential to access github, you should choose between username/password authentication or token (for two step verification accounts) | |
$githubUser = 'YOURGITHUBUSER'; | |
$githubPasswd = 'YOURGITHUBPASSWD'; | |
// or | |
//$githubToken = 'YOURGITHUBTOKEN'; | |
$githubOrganization = 'YOURGITHUBORGANIZATION'; | |
// the list of repo in your github organization you want to align | |
$repos = array( | |
'YOURREPO#1', | |
'YOURREPO#2', | |
'YOURREPO#3', | |
// ... | |
); | |
// Add, remove, or set names and colors of issue labels as you wish | |
$arrayLabels = [ | |
'a:docs' => 'c7def8', | |
'a:design' => 'c7def8', | |
'a:sysops' => 'c7def8', | |
'a:customer' => 'c7def8', | |
'e:1' => 'd4c5f9', | |
'e:2' => 'd4c5f9', | |
'e:3' => 'd4c5f9', | |
'p:blocker' => 'e11d21', | |
'p:high' => 'f7c6c7', | |
'p:normal' => 'f7c6c7', | |
'p:low' => 'f7c6c7', | |
's:in-process' => 'fef2c0', | |
's:needs-discussion' => 'fbca04', | |
't:bug' => 'bfe5bf', | |
't:idea' => 'bfe5bf', | |
't:support' => 'bfe5bf', | |
't:feature' => 'bfe5bf', | |
't:question' => 'bfe5bf', | |
't:refactor' => 'bfe5bf', | |
't:improvement' => 'bfe5bf', | |
't:discussion' => 'bfe5bf' | |
]; | |
$arrayMilestones = [ | |
[ | |
'title' => 'Next Iteration', | |
'description' => 'What are we doing right now?' | |
], | |
[ | |
'title' => 'Next Tasks', | |
'description' => 'What we are not doing right now? but we will probably do soon' | |
], | |
[ | |
'title' => 'Blue Sky', | |
'description' => 'What we are not doing right now? but we will probably will not do soon' | |
] | |
]; | |
foreach( $repos as $repo ) { | |
foreach( $arrayMilestones as $milestone ) { | |
$milestoneToSet = '\'{ "title": "' . $milestone['title'] .'","description": "' . $milestone['description'] . '" }\''; | |
if (isset($githubToken)) { | |
system( 'curl -u ' . $githubToken . ':x-oauth-basic https://api.github.com/repos/' . $githubOrganization . '/' . $repo . '/milestones -X POST --data ' . $milestoneToSet ); | |
} else { | |
system( 'curl -u "' . $githubUser . ':' . $githubPasswd . '" https://api.github.com/repos/' . $githubOrganization . '/' . $repo . '/milestones -X POST --data ' . $milestoneToSet ); | |
} | |
} | |
foreach( $arrayLabels as $name => $color ) { | |
$labelToSet = '\'{ "name": "' . $name .'","color": "' . $color . '" }\''; | |
if (isset($githubToken)) { | |
system( 'curl -u ' . $githubToken . ':x-oauth-basic https://api.github.com/repos/' . $githubOrganization . '/' . $repo . '/labels -X POST --data ' . $labelToSet ); | |
} else { | |
system( 'curl -u "' . $githubUser . ':' . $githubPasswd . '" https://api.github.com/repos/' . $githubOrganization . '/' . $repo . '/labels -X POST --data ' . $labelToSet ); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Added support to
milestones