Skip to content

Commit 4d0ecae

Browse files
committed
Minor refactor + formatting for approval comment
1 parent 0c79f78 commit 4d0ecae

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

.github/workflows/rfc_approval.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
// -------------------------------------------------
5151
if (context.eventName === 'issues' && context.payload.action === 'opened') {
5252
console.log('Creating initial comment for review status');
53-
const body = `# RFC approval status: Pending\n\nCore team approvers:\nRejection from:\nAwaiting approval from:`;
53+
const body = `## RFC approval status: 🕐 Pending\n\nCore team approvers:\nRejection from: -\nAwaiting approval from:`;
5454
5555
await github.rest.issues.createComment({
5656
owner: org,
@@ -97,13 +97,16 @@ jobs:
9797
console.log(`Rejections (${rejections.size}):`, [...rejections]);
9898
9999
const awaiting = teamMembers.filter(u => !approvals.has(u) && !rejections.has(u));
100-
const status = approvals.size >= quorum && rejections.size === 0 ? 'Approved' : 'Pending';
100+
const status = approvals.size >= quorum && rejections.size === 0 ? 'Approved' : '🕐 Pending';
101101
102-
const statusBody = `# RFC approval status: ${status}\n\nCore team approvers: ${approvals.size ? [...approvals].join(', ') : 'None'}\nRejection from: ${rejections.size ? [...rejections].join(', ') : 'None'}\nAwaiting approval from: ${awaiting.length ? awaiting.join(', ') : 'None'}`;
102+
function formatUserList(users) {
103+
return users.length ? users.map(u => `[@${u}](https://github.com/${u})`).join(', ') : '-';
104+
}
105+
const statusBody = `## RFC approval status: ${status}\n\nCore team approvers: ${formatUserList([...approvals])}\nRejection from: ${formatUserList([...rejections])}\nAwaiting approval from: ${formatUserList(awaiting)}`;
103106
console.log('New status body to post:\n', statusBody);
104107
105108
// Try to locate the existing status comment (starts with our header)
106-
let statusComment = comments.find(c => c.body.startsWith('# RFC approval status:'));
109+
let statusComment = comments.find(c => c.body.startsWith('## RFC approval status:'));
107110
108111
if (statusComment) {
109112
await github.rest.issues.updateComment({

0 commit comments

Comments
 (0)