Skip to content
Merged
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
feat(changelog): group PR list by author in markdown
Signed-off-by: John Molakvoæ <[email protected]>
  • Loading branch information
skjnldsv committed May 10, 2023
commit 17c766a3cb4c5ad50591e32d2eddcbd54661d08e
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