mirror of
https://github.com/boostorg/boost-tasks.git
synced 2026-01-19 16:12:13 +00:00
38 lines
1.0 KiB
PHP
38 lines
1.0 KiB
PHP
#!/usr/bin/env php
|
|
<?php
|
|
require_once(__DIR__.'/vendor/autoload.php');
|
|
|
|
use GetOptionKit\OptionCollection;
|
|
use BoostTasks\Settings;
|
|
use BoostTasks\CommandLineOptions;
|
|
|
|
function main($args) {
|
|
$specs = new OptionCollection;
|
|
$options = CommandLineOptions::process($args,
|
|
'List pull requests',
|
|
$specs);
|
|
if (is_numeric($options)) { exit($options); }
|
|
Settings::init($options);
|
|
|
|
$username = 'danieljames';
|
|
$organisation = 'boostorg';
|
|
|
|
$repos = array();
|
|
foreach(Settings::githubCache()->iterate("/users/{$username}/subscriptions") as $subscription) {
|
|
if ($subscription->owner->login == $organisation) {
|
|
$repos[] = $subscription->full_name;
|
|
}
|
|
}
|
|
|
|
if ($repos) {
|
|
$db = Settings::database();
|
|
$query = 'WHERE repo_full_name IN ( ?';
|
|
$query .= str_repeat(', ?', count($repos) - 1);
|
|
$query .= ' )';
|
|
$pull_requests = $db->findAll('pull_request', $query, $repos);
|
|
print_r($pull_requests);
|
|
}
|
|
}
|
|
|
|
main($_SERVER['argv']);
|