Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 23 additions & 10 deletions RoboFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ public function buildDocs()
$this->buildDocsStub();
$this->buildDocsApi();
$this->buildDocsExtensions();
$this->changelog();
}

public function buildDocsModules()
Expand Down Expand Up @@ -555,16 +554,11 @@ public function processChangelog()
if ($repository['disabled'] || $repository['archived']) {
continue;
}
try {
$releases = $client->repo()->releases()->all('codeception', $repositoryName);
foreach ($releases as $k=> $release) {
$releases[$k]['repo'] = $repositoryName;
}
$allReleases = array_merge($allReleases, $releases);
} catch (\Exception $err) {
// $this->say("Repository not available " . $repository['name']);
// $this->say($err->getMessage());
$releases = $this->fetchReleases($client, $repositoryName);
foreach ($releases as $k=> $release) {
$releases[$k]['repo'] = $repositoryName;
}
$allReleases = array_merge($allReleases, $releases);
}

usort($allReleases, function($r1, $r2) {
Expand Down Expand Up @@ -603,6 +597,25 @@ public function processChangelog()
return $changelog;
}

/**
* Retries transient GitHub API failures. Gives up by throwing, so that
* an incomplete changelog is never written and published.
*/
private function fetchReleases(\Github\Client $client, string $repositoryName, int $attempts = 3): array
{
for ($attempt = 1; ; $attempt++) {
try {
return $client->repo()->releases()->all('codeception', $repositoryName);
} catch (\Exception $err) {
$this->say("Fetching releases of $repositoryName failed (attempt $attempt/$attempts): " . $err->getMessage());
if ($attempt >= $attempts) {
throw new \RuntimeException("Could not fetch releases of $repositoryName", 0, $err);
}
sleep(5 * $attempt);
}
}
}

public function updateBuildsPage()
{
$sortByVersion = function (\SplFileInfo $a, \SplFileInfo $b) {
Expand Down