From be3a0b269a7ddff2e5f0f2ae364cf2e50c780980 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sat, 15 Jan 2011 02:06:23 +0100 Subject: [ticket/9805] Script for easily cloning a whole github network. PHPBB3-9805 --- git-tools/setup_github_network.php | 179 +++++++++++++++++++++++++++++++++++++ 1 file changed, 179 insertions(+) create mode 100644 git-tools/setup_github_network.php (limited to 'git-tools') diff --git a/git-tools/setup_github_network.php b/git-tools/setup_github_network.php new file mode 100644 index 0000000000..bc8e70cfbd --- /dev/null +++ b/git-tools/setup_github_network.php @@ -0,0 +1,179 @@ +contributors as $contributor) + { + $usernames[$contributor->login] = $contributor->login; + } + + return $usernames; +} + +function get_organisation_members($username) +{ + $request = api_request("organizations/$username/public_members"); + + $usernames = array(); + foreach ($request->users as $member) + { + $usernames[$member->login] = $member->login; + } + + return $usernames; +} + +function get_collaborators($username, $repository) +{ + $request = api_request("repos/show/$username/$repository/collaborators"); + + $usernames = array(); + foreach ($request->collaborators as $collaborator) + { + $usernames[$collaborator] = $collaborator; + } + + return $usernames; +} + +function get_network($username, $repository) +{ + $request = api_request("repos/show/$username/$repository/network"); + + $usernames = array(); + foreach ($request->network as $network) + { + $usernames[$network->owner] = array( + 'username' => $network->owner, + 'repository' => $network->name, + ); + } + + return $usernames; +} + +function show_usage($argv) +{ + printf( + "usage: php %s collaborators|organisation|contributors|network [your_github_username]\n", + basename($argv[0]) + ); + exit(1); +} + +function get_arg($argv, $index, $default) +{ + return isset($argv[$index]) ? $argv[$index] : $default; +} + +function run($cmd) +{ + passthru(escapeshellcmd($cmd)); +} -- cgit v1.2.1