-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.php
28 lines (20 loc) · 751 Bytes
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
require_once(__DIR__ . '/client/GitHubClient.php');
$repos = array(
'socket.io-basic-realtime-messaging-demo'
);
$username = $argv[1];
$password = $argv[2];
$branch_name = $argv[3]; // branch name
$collaborator = $argv[4]; // collaborator
$client = new GitHubClient();
$client->setCredentials($username, $password);
/* get references */
$refs = $client->refs->getAllReferences($username, $repos[0]);
$first_ref = $refs[0];
$master_sha = $first_ref->getObject()->sha;
/* create branch */
$create_branch_response = $client->refs->post($username, $repos[0], $branch_name, $master_sha);
/* add collaborator */
$collaborator_response = $client->repos->collaborators->put($username, $repos[0], $collaborator, ['permission' => 'push']);
exit;