diff options
author | blizzz <blizzz@arthur-schiwon.de> | 2021-10-13 16:24:24 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-13 16:24:24 +0300 |
commit | bc1d1a2cdfd267414fb97a7c8c7751a5ce1b30d2 (patch) | |
tree | d1c0171d39e8eb4d3f1b44eec27e7f36bf81ce4f | |
parent | e8ef1056a94bc2d0902c7145860d4f0da9c0be12 (diff) | |
parent | 63326a2abeff7082b13e32cbd269fafb7a62d284 (diff) |
Merge pull request #34 from nextcloud/enh/noid/changelog-from-beta0
allow fetching pending PRs for first beta
-rw-r--r-- | README.md | 7 | ||||
-rw-r--r-- | changelog/index.php | 45 |
2 files changed, 31 insertions, 21 deletions
@@ -43,4 +43,11 @@ E.g. generate the changelog for the upcoming 3.3.0 Android release: php index.php generate:changelog android stable-3.3.0 stable-3.3.x ``` +E.g. to generate the pending PRs for a very first beta of a major release run (mind, the vxx.0.0beta0 tag is expected NOT to exist)): + +``` +php index.php generate:changelog server v42.0.0beta0 master +``` + + diff --git a/changelog/index.php b/changelog/index.php index 55da9a8..6238923 100644 --- a/changelog/index.php +++ b/changelog/index.php @@ -196,33 +196,36 @@ class GenerateChangelogCommand extends Command $progressBar->setMessage('Starting ...'); $progressBar->start(); - foreach ($reposToIterate as $repoName) { + $isBetaNull = strpos($base, 'beta0') !== false; + foreach ($reposToIterate as $repoName) { $pullRequests = []; /** @var \Github\Api\Repo $repo */ $repo = $client->api('repo'); - try { - $progressBar->setMessage("Fetching git history for $repoName..."); - $diff = $repo->commits()->compare($orgName, $repoName, $base, $head); - } catch (\Github\Exception\RuntimeException $e) { - if ($e->getMessage() === 'Not Found') { - $output->writeln('<error>Could not find base or head reference on ' . $repoName. '.</error>'); - // print 3 empty lines to not overwrite the error message with the progress bar - $output->writeln(''); - $output->writeln(''); - $output->writeln(''); - continue; + if (!$isBetaNull) { + try { + $progressBar->setMessage("Fetching git history for $repoName..."); + $diff = $repo->commits()->compare($orgName, $repoName, $base, $head); + } catch (\Github\Exception\RuntimeException $e) { + if ($e->getMessage() === 'Not Found') { + $output->writeln('<error>Could not find base or head reference on ' . $repoName . '.</error>'); + // print 3 empty lines to not overwrite the error message with the progress bar + $output->writeln(''); + $output->writeln(''); + $output->writeln(''); + continue; + } + throw $e; } - throw $e; - } - foreach ($diff['commits'] as $commit) { - $fullMessage = $commit['commit']['message']; - list($firstLine,) = explode("\n", $fullMessage, 2); - if (substr($firstLine, 0, 20) === 'Merge pull request #') { - $firstLine = substr($firstLine, 20); - list($number,) = explode(" ", $firstLine, 2); - $pullRequests[] = $number; + foreach ($diff['commits'] as $commit) { + $fullMessage = $commit['commit']['message']; + list($firstLine,) = explode("\n", $fullMessage, 2); + if (substr($firstLine, 0, 20) === 'Merge pull request #') { + $firstLine = substr($firstLine, 20); + list($number,) = explode(" ", $firstLine, 2); + $pullRequests[] = $number; + } } } $progressBar->advance(); |