Skip to content

Commit 64ab13c

Browse files
committed
chore: define and parse default reviewers from team_members comment in CODEOWNERS
1 parent 68f244e commit 64ab13c

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

.github/CODEOWNERS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66

77

88
# The cloud sdk nodejs team is the default owner for nodejs repositories.
9-
* @pearigee @feywind @djbruce @shivanee-p
9+
# team_members: @pearigee @feywind @djbruce @shivanee-p
10+
* @googleapis/cloud-sdk-nodejs-team
1011
/handwritten/bigquery @googleapis/bigquery-team
1112
/handwritten/cloud-profiler @googleapis/cloud-profiler-team
1213
/handwritten/storage @googleapis/gcs-team

.github/workflows/assign-reviewers.yml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -112,19 +112,18 @@ jobs:
112112
const content = Buffer.from(codeownersData.content, 'base64').toString('utf-8');
113113
const lines = content.split('\n');
114114
for (const line of lines) {
115-
const commentIdx = line.indexOf('#');
116-
const cleanLine = (commentIdx !== -1 ? line.substring(0, commentIdx) : line).trim();
117-
if (!cleanLine) continue;
118-
119-
const parts = cleanLine.split(/\s+/);
120-
const pattern = parts[0];
121-
if (pattern === '*') {
122-
const owners = parts.slice(1);
123-
defaultReviewers = owners
124-
.filter(p => p.startsWith('@') && !p.includes('/'))
125-
.map(p => p.substring(1))
126-
.filter(login => login !== author);
127-
break;
115+
const trimmed = line.trim();
116+
if (trimmed.startsWith('#')) {
117+
const commentContent = trimmed.substring(1).trim();
118+
if (commentContent.startsWith('team_members:')) {
119+
const listPart = commentContent.substring('team_members:'.length).trim();
120+
const parts = listPart.split(/\s+/);
121+
defaultReviewers = parts
122+
.filter(p => p.startsWith('@'))
123+
.map(p => p.substring(1))
124+
.filter(login => login !== author);
125+
break;
126+
}
128127
}
129128
}
130129
} catch (err) {

0 commit comments

Comments
 (0)