Skip to content

Commit b0b5362

Browse files
authored
fix: enabled open to community review for bot-authored PRs (hiero-ledger#2313)
Signed-off-by: Rayan Kamdem <rayankdm@umich.edu>
1 parent d02fb59 commit b0b5362

3 files changed

Lines changed: 7 additions & 8 deletions

File tree

.github/scripts/review-sync/helpers/labels.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,11 @@ async function syncLabel(github, owner, repo, pr, dryRun) {
178178
(name) => ALL_QUEUE_LABEL_NAMES.includes(name) && name !== correctLabel.name
179179
);
180180

181-
const isHuman = pr.user && pr.user.type !== 'Bot';
182-
const needsCommunityReview = isHuman && !currentLabels.includes(COMMUNITY_REVIEW.name);
181+
const needsCommunityReview = !currentLabels.includes(COMMUNITY_REVIEW.name);
183182

184183
// Check if the correct labels are already present AND there are no stale labels to remove
185184
if (currentLabels.includes(correctLabel.name) && staleLabels.length === 0 && !needsCommunityReview) {
186-
console.log(` ✓ Already has "${correctLabel.name}"${isHuman ? ` and "${COMMUNITY_REVIEW.name}"` : ''}. No change needed.`);
185+
console.log(` ✓ Already has "${correctLabel.name}" and "${COMMUNITY_REVIEW.name}". No change needed.`);
187186
return false;
188187
}
189188

.github/scripts/review-sync/tests/test-labels.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ const unitTests = [
113113
name: 'syncLabel: already correct, no stale → returns false',
114114
test: async () => {
115115
const mock = createMockGithub({ roles: {}, reviews: [] });
116-
const changed = await syncLabel(mock, 'o', 'r', { number: 1, labels: [{ name: 'queue:junior-committer' }], head: { sha: '123' }, user: { type: 'Bot' } }, false);
116+
const changed = await syncLabel(mock, 'o', 'r', { number: 1, labels: [{ name: 'queue:junior-committer' }, { name: COMMUNITY_REVIEW.name }], head: { sha: '123' }, user: { type: 'Bot' } }, false);
117117
return changed === false && mock.calls.labelsAdded.length === 0;
118118
},
119119
},
@@ -152,13 +152,13 @@ const unitTests = [
152152
},
153153
},
154154
{
155-
name: 'syncLabel: bot PR does NOT receive community review label',
155+
name: 'syncLabel: bot PR receives community review label if missing',
156156
test: async () => {
157157
const mock = createMockGithub({ roles: {}, reviews: [] });
158158
const pr = { number: 1, labels: [{ name: 'queue:junior-committer' }], head: { sha: '123' }, user: { type: 'Bot' } };
159159
const changed = await syncLabel(mock, 'o', 'r', pr, false);
160-
// Already has junior-committer, and being a Bot means it shouldn't add community review
161-
return changed === false && mock.calls.labelsAdded.length === 0;
160+
// Already has junior-committer; missing COMMUNITY_REVIEW should be added for bot PRs too
161+
return changed === true && mock.calls.labelsAdded.includes(COMMUNITY_REVIEW.name);
162162
},
163163
},
164164
{

.github/workflows/request-triage-review.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
contains(github.event.pull_request.labels.*.name, 'Good First Issue') ||
1919
contains(github.event.pull_request.labels.*.name, 'skill: beginner') ||
2020
contains(github.event.pull_request.labels.*.name, 'beginner')
21-
runs-on: [self-hosted, hl-sdk-py-lin-md]
21+
runs-on: hl-sdk-py-lin-md
2222

2323
steps:
2424
- name: Harden the runner (Audit all outbound calls)

0 commit comments

Comments
 (0)