Skip to content

Commit a1d99ad

Browse files
committed
try using another api for checking
1 parent 8903e9d commit a1d99ad

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

.github/workflows/sync-pr-labels.yml

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -270,31 +270,22 @@ jobs:
270270
271271
const contributorLabels = [];
272272
273-
// Check if contributor is a member of the organization
274-
try {
275-
await github.rest.orgs.checkMembershipForUser({
276-
org: context.repo.owner,
277-
username: prAuthor
278-
});
279-
contributorLabels.push('member');
280-
} catch (error) {
281-
// Not a member
282-
if (commits.data.length <= 1) {
283-
contributorLabels.push('first-time-contributor');
284-
} else {
285-
contributorLabels.push('external-contributor');
286-
}
273+
// Determine contributor type based on commit count
274+
if (commits.data.length <= 1) {
275+
contributorLabels.push('first-time-contributor');
276+
} else {
277+
contributorLabels.push('external-contributor');
287278
}
288279
289-
// Check if PR author is a collaborator
280+
// Maintainer check
290281
try {
291282
const permissionLevel = await github.rest.repos.getCollaboratorPermissionLevel({
292283
owner: context.repo.owner,
293284
repo: context.repo.repo,
294285
username: prAuthor
295286
});
296287
297-
if (permissionLevel.data.permission === 'admin' || permissionLevel.data.permission === 'maintain') {
288+
if (['admin', 'maintain'].includes(permissionLevel.data.permission)) {
298289
contributorLabels.push('maintainer');
299290
}
300291
} catch (error) {

0 commit comments

Comments
 (0)