Skip to content

Commit 336dc51

Browse files
committed
Only show the line about users without write access if it is detected
Signed-off-by: Yoriyasu Yano <[email protected]>
1 parent 9612b44 commit 336dc51

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

ghevent/pullrequest.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,15 @@ async function runReviewRoutine(
211211
const reasonLines = [];
212212
reasonLines.push(
213213
`The change set did not pass the auto-approval rule [${repoCfg.ruleFile}](${ruleFileURL}) and it does not have the required number of approvals (${numApprovals} < ${requiredApprovals}).`,
214-
"",
215-
"The following users approved the PR, but do not have write access to the repository:",
216214
);
217-
for (const u of nonWriterApprovalUsers) {
218-
reasonLines.push(`- \`${u}\``);
215+
if (nonWriterApprovalUsers.length > 0) {
216+
reasonLines.push("");
217+
reasonLines.push(
218+
"The following users approved the PR, but do not have write access to the repository:",
219+
);
220+
for (const u of nonWriterApprovalUsers) {
221+
reasonLines.push(`- \`${u}\``);
222+
}
219223
}
220224
const reason = reasonLines.join("\n");
221225
const [summary, details] = formatCheckOutputText(

0 commit comments

Comments
 (0)