Skip to content

Commit 7c66472

Browse files
authored
Merge pull request #40 from saschanaz/patch-1
Do not early return when no relevant code owner exists
2 parents 311c487 + fce1927 commit 7c66472

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

index.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,6 @@ async function commentOnMergablePRs() {
5252
core.info(`Code-owners: \n - ${codeowners.users.join("\n - ")}`)
5353
core.info(`Labels: \n - ${codeowners.labels.join("\n - ")}`)
5454

55-
if (!codeowners.users.length) {
56-
console.log("This PR does not have any code-owners")
57-
process.exit(0)
58-
}
59-
60-
61-
62-
6355
// Determine who has access to merge every file in this PR
6456
const ownersWhoHaveAccessToAllFilesInPR = []
6557
codeowners.users.forEach(owner => {
@@ -86,6 +78,11 @@ async function commentOnMergablePRs() {
8678
process.exit(0)
8779
}
8880

81+
if (!codeowners.users.length) {
82+
console.log("This PR does not have any code-owners")
83+
process.exit(0)
84+
}
85+
8986
const ourSignature = "<!-- Message About Merging -->"
9087
const comments = await octokit.issues.listComments({ ...thisRepo, issue_number: pr.number })
9188
const existingComment = comments.data.find(c => c.body.includes(ourSignature))

0 commit comments

Comments
 (0)