Skip to content
Closed
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
20 changes: 15 additions & 5 deletions tools/rfc-render/fetch-issues.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ async function issuesGroupedByStatus(filterStatus = undefined) {
link = `https://github.com/aws/aws-cdk-rfcs/issues/${issue.number}`;
}

(issueByStatus[status] ??= []).push({
(issueByStatus[status] ??= []).push({
number: issue.number,
title: issue.title,
link,
Expand All @@ -79,16 +79,26 @@ function findDocFile(files, number) {

function findMetadata(issue) {
const body = issue.body || '';
const lines = body.split('\n');
const lines = body.split(/\r?\n/);
const titleIndex = lines.findIndex(line => line.startsWith('|PR|Champion|'));
if (titleIndex === -1) {
if (titleIndex === -1 || titleIndex + 2 >= lines.length) {
return { champion: '' };
}

let [, pr, champion] = lines[titleIndex + 2].split('|');
const dataLine = lines[titleIndex + 2];
if (!dataLine) {
return { champion: '' };
}

const parts = dataLine.split('|');
if (parts.length < 3) {
return { champion: '' };
}

let [, pr, champion] = parts;
champion = champion ? champion.trim() : '';

const pr_number = (pr.startsWith('#') ? pr.substring(1) : '').trim();
const pr_number = (pr && pr.startsWith('#') ? pr.substring(1) : '').trim();
return { champion, pr_number };
}

Expand Down
Loading