├── .gitignore ├── composer.json ├── README.md ├── COPYING └── run.php /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | composer.lock 3 | vendor -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": { 3 | "addshore/github-hook-controller": "0.1.*" 4 | } 5 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | WMDE github-hook-updater 2 | ================== 3 | 4 | Makes changing all of the github IRC hooks for WMDE stuff easy 5 | 6 | ## Usage 7 | 8 | The first step to use this script is to download composer: 9 | 10 | ```bash 11 | $ curl -s http://getcomposer.org/installer | php 12 | ``` 13 | 14 | Then we have to install our dependencies using: 15 | ```bash 16 | $ php composer.phar install 17 | ``` 18 | 19 | Then we just have to run run.php: 20 | ```bash 21 | $ php run.php 22 | ``` 23 | 24 | We will be prompted for an access token which can be retrieved from https://github.com/settings/tokens 25 | ```bash 26 | $ Please generate a personal access token at https://github.com/settings/tokens 27 | $ Github Token: 28 | ``` 29 | 30 | The hooks will then be updated! -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /run.php: -------------------------------------------------------------------------------- 1 | array( 8 | 'wmde' => array( 9 | 'Ask', 10 | 'AskSerialization', 11 | 'AskWikitextSerialization', 12 | 'Assert', 13 | 'DataTypes', 14 | 'DataValuesJavascript', 15 | 'Diff', 16 | 'puppet-wikidata-test', 17 | 'puppet-builder', 18 | 'puppet-composer', 19 | 'Serialization', 20 | 'ValueView', 21 | 'wbs_propertypairs', 22 | 'WikibaseDatabase', 23 | 'WikibaseDataModel', 24 | 'WikibaseDataModelServices', 25 | 'WikibaseDataModelSerialization', 26 | 'WikibaseDataModelJavascript', 27 | 'WikibaseEntityStore', 28 | 'WikibaseInternalSerialization', 29 | 'WikibaseSerializationJavaScript', 30 | 'WikibaseQuery', 31 | 'WikibaseQueryEngine', 32 | 'Wikiba.se', 33 | 'WikidataApiGem', 34 | 'WikidataBuilder', 35 | 'WikidataBrowserTests', 36 | 'WikidataBrowserTestsRSpec', 37 | 'wikidata-analysis', 38 | 'Wikidata.org', 39 | 'WikimediaBadges', 40 | ), 41 | 'Wikidata' => array( 42 | 'easyrdf_lite', 43 | ), 44 | 'Wikidata-lib' => array( 45 | 'PropertySuggester', 46 | 'PropertySuggester-Python', 47 | 'Wikidata.lib', 48 | 'PubSubHubbubSubscriber', 49 | 'ConnectionFinder', 50 | ), 51 | 'DataValues' => array( 52 | 'Geo', 53 | 'Number', 54 | 'Common', 55 | 'Interfaces', 56 | 'DataValues', 57 | 'Serialization', 58 | 'Validators', 59 | 'Time', 60 | 'Iri', 61 | ), 62 | ), 63 | '#wikimedia-de-tech' => array( 64 | 'wmde' => array( 65 | 'github-hook-updater', 66 | 'phragile', 67 | 'Lizenzverweisgenerator', 68 | 'commons-metadata-extractor', 69 | 'Datentankstelle', 70 | 'DeepCat-Gadget', 71 | 'catgraph-client-python', 72 | 'catgraph-client-php', 73 | 'catgraph-jsonp', 74 | 'catgraph-service', 75 | 'catgraph-web', 76 | 'ContentStaging', 77 | 'file-reuse-test', 78 | 'graphite-backup', 79 | 'gtwl-slurp', 80 | 'graphserv', 81 | 'graphcore', 82 | 'graphcare', 83 | 'Wikipedia.de', 84 | ), 85 | ), 86 | ); 87 | 88 | require_once __DIR__ . '/vendor/autoload.php'; 89 | 90 | echo "Please generate a personal access token at https://github.com/settings/tokens\n"; 91 | echo "The token can be deleted after using run.php\n"; 92 | echo "It is probably best to give the token ALL permissions\n"; 93 | echo "Github Token:"; 94 | $token = stream_get_line(STDIN, 1024, "\n"); 95 | 96 | $client = new \Github\Client(); 97 | $client->authenticate( $token, null, \Github\Client::AUTH_HTTP_TOKEN ); 98 | 99 | $controller = new \GithubHookController\IrcHookController( $client ); 100 | 101 | echo "Adding and Updating hooks!\n"; 102 | foreach( $hookTargets as $channel => $userRepos ) { 103 | echo "\n$channel\n"; 104 | foreach ( $userRepos as $user => $repos ) { 105 | foreach ( $repos as $repo ) { 106 | 107 | $hook = array( 108 | 'name' => 'irc', 109 | 'active' => true, 110 | 'config' => array( 111 | 'server' => 'chat.freenode.org', 112 | 'port' => '7000', 113 | 'room' => $channel, 114 | 'nick' => 'gh-' . strtolower( $user ), 115 | 'ssl' => '1', 116 | ), 117 | 'events' => array( 118 | 'push', 'pull_request', 'commit_comment', 'pull_request_review_comment' 119 | ), 120 | ); 121 | try { 122 | $controller->setIrcHook( $hook, $user, $repo ); 123 | echo( "Done " . $user . '/' . $repo . "\n" ); 124 | } 125 | catch( Github\Exception\RuntimeException $e ) { 126 | echo "Error " . $user . '/' . $repo . ': ' . $e->getCode() . ' ' . $e->getMessage(); 127 | if( $e->getCode() == "404" ) { 128 | echo " (this could be due to lack of permissions on the repo)"; 129 | } 130 | echo "\n"; 131 | } 132 | } 133 | } 134 | } 135 | --------------------------------------------------------------------------------