From c96d5b37195eda1f9d28e4659c0b255fcd328697 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 28 Jul 2025 13:07:51 +0000 Subject: [PATCH 1/2] Initial plan From 8086a1b6b590121dc8dffad0e35b9132194eea36 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 28 Jul 2025 13:18:17 +0000 Subject: [PATCH 2/2] Implement organization-wide contributor fetching from all yiisoft repositories Co-authored-by: samdark <47294+samdark@users.noreply.github.com> --- commands/ContributorsController.php | 59 ++++++++++++++++++++++++++--- views/site/team.php | 4 +- 2 files changed, 55 insertions(+), 8 deletions(-) diff --git a/commands/ContributorsController.php b/commands/ContributorsController.php index 40a68103..4d93b86c 100644 --- a/commands/ContributorsController.php +++ b/commands/ContributorsController.php @@ -49,14 +49,61 @@ public function actionGenerate() $token = trim(file_get_contents($tokenFile)); $client->authenticate($token, null, \Github\Client::AUTH_HTTP_TOKEN); } + + // Get all repositories from yiisoft organization + $orgApi = $client->api('organization'); + $orgPaginator = new \Github\ResultPager($client); + $this->stdout("Fetching all repositories from yiisoft organization...\n"); + $repositories = $orgPaginator->fetch($orgApi, 'repositories', ['yiisoft']); + + while ($orgPaginator->hasNext()) { + $repositories = array_merge($repositories, $orgPaginator->fetchNext()); + } + + $this->stdout("Found " . count($repositories) . " repositories in yiisoft organization.\n"); + + // Aggregate contributors from all repositories + $allContributors = []; $api = $client->api('repo'); - $paginator = new \Github\ResultPager($client); - $parameters = ['yiisoft', 'yii2']; - $rawContributors = $paginator->fetch($api, 'contributors', $parameters); - - while ($paginator->hasNext() && count($rawContributors) < $contributorLimit) { - $rawContributors = array_merge($rawContributors, $paginator->fetchNext()); + + foreach ($repositories as $repo) { + $repoName = $repo['name']; + $this->stdout("Fetching contributors from yiisoft/{$repoName}...\n"); + + try { + $paginator = new \Github\ResultPager($client); + $parameters = ['yiisoft', $repoName]; + $repoContributors = $paginator->fetch($api, 'contributors', $parameters); + + while ($paginator->hasNext() && count($allContributors) < $contributorLimit) { + $repoContributors = array_merge($repoContributors, $paginator->fetchNext()); + } + + // Merge contributors, summing contributions for duplicates + foreach ($repoContributors as $contributor) { + $login = $contributor['login']; + if (isset($allContributors[$login])) { + $allContributors[$login]['contributions'] += $contributor['contributions']; + } else { + $allContributors[$login] = $contributor; + } + } + + if (count($allContributors) >= $contributorLimit) { + $this->stdout("Reached contributor limit of {$contributorLimit}.\n"); + break; + } + } catch (\Exception $e) { + $this->stdout("Warning: Could not fetch contributors from {$repoName}: " . $e->getMessage() . "\n"); + continue; + } } + + // Convert back to indexed array and sort by contributions + $rawContributors = array_values($allContributors); + usort($rawContributors, function($a, $b) { + return $b['contributions'] - $a['contributions']; + }); // remove team members $teamGithubs = array_filter(array_map(function ($member) { diff --git a/views/site/team.php b/views/site/team.php index bb94e917..669287ca 100644 --- a/views/site/team.php +++ b/views/site/team.php @@ -143,7 +143,7 @@

- There is a huge community of contributors working on the Yii Framework code. + There is a huge community of contributors working on the Yii Framework code. Without their help it would not be possible to provide and maintain the huge amount of functionality, documentation, and translations.

@@ -156,7 +156,7 @@

- The following list shows all the people who have contributed to the yiisoft/yii2 repository on Github. + The following list shows all the people who have contributed to yiisoft repositories on Github. If you are one of them, thank you! If not, !