Skip to content

Commit

Permalink
Merge pull request #79 from nextcloud/feat/group-PR-by-authors
Browse files Browse the repository at this point in the history
  • Loading branch information
skjnldsv authored May 10, 2023
2 parents f61a0d2 + 17c766a commit 6a81bf4
Showing 1 changed file with 37 additions and 22 deletions.
59 changes: 37 additions & 22 deletions changelog/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -463,30 +463,45 @@ protected function execute(InputInterface $input, OutputInterface $output)
$output->writeln("* $orgName/$repoName#$number");
}
}

// Do we have pending PRs?
if (count($prTitles['pending'])) {
$output->writeln("\n\nPending PRs:\n");
}
foreach ($prTitles['pending'] as $id => $data) {
$repoName = $data['repoName'];
$number = $data['number'];
$title = $data['title'];
$author = array_key_exists('author', $data) ? '@' . $data['author'] : '';
if ($author === '@backportbot-nextcloud') {
$author = '';
}
if ($author === '@dependabot-preview') {
$author = '';
}
if ($author === '@dependabot') {
$author = '';
}
if ($author === '@dependabot[bot]') {
$author = '';
$output->writeln("\n\n## Pending PRs:");

// Group PR by authors
$pendingPRs = $prTitles['pending'];
function cmp($a, $b) {
return strnatcasecmp($a['author'], $b['author']);
}
if ($repoName === 'server') {
$output->writeln("* [ ] #$number $author");
} else {
$output->writeln("* [ ] $orgName/$repoName#$number $author");
usort($pendingPRs, "cmp");

$prevAuthor = '';
foreach ($pendingPRs as $id => $data) {
$repoName = $data['repoName'];
$number = $data['number'];
$title = $data['title'];
$author = array_key_exists('author', $data) ? '@' . $data['author'] : '';
if ($author === '@backportbot-nextcloud') {
$author = '';
}
if ($author === '@dependabot-preview') {
$author = '';
}
if ($author === '@dependabot') {
$author = '';
}
if ($author === '@dependabot[bot]') {
$author = '';
}
if ($prevAuthor !== $author) {
$output->writeln("* $author");
$prevAuthor = $author;
}
if ($repoName === 'server') {
$output->writeln(" * [ ] #$number");
} else {
$output->writeln(" * [ ] $orgName/$repoName#$number");
}
}
}
break;
Expand Down

0 comments on commit 6a81bf4

Please sign in to comment.