Skip to content

Commit b8d4684

Browse files
authored
Merge pull request #2569 from hathach/fix-labler-error
try catch labeler rest api
2 parents 60acb99 + 252e630 commit b8d4684

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

.github/workflows/labeler.yml

+20-18
Original file line numberDiff line numberDiff line change
@@ -28,29 +28,31 @@ jobs:
2828
issueOrPrNumber = context.payload.pull_request.number;
2929
}
3030
31-
// Check for Adafruit membership
32-
const adafruitResponse = await github.rest.orgs.checkMembershipForUser({
33-
org: 'adafruit',
34-
username: username
35-
});
36-
37-
if (adafruitResponse.status === 204) {
38-
console.log('Adafruit Member');
39-
label = 'Prio Urgent';
40-
} else {
41-
// Check if the user is a contributor
42-
const collaboratorResponse = await github.rest.repos.checkCollaborator({
43-
owner: context.repo.owner,
44-
repo: context.repo.repo,
31+
try {
32+
// Check for Adafruit membership
33+
const adafruitResponse = await github.rest.orgs.checkMembershipForUser({
34+
org: 'adafruit',
4535
username: username
4636
});
4737
48-
if (collaboratorResponse.status === 204) {
49-
console.log('Contributor');
50-
label = 'Prio Higher';
38+
if (adafruitResponse.status === 204) {
39+
console.log('Adafruit Member');
40+
label = 'Prio Urgent';
5141
} else {
52-
console.log('Not a contributor or Adafruit member');
42+
// If not a Adafruit member, check if the user is a contributor
43+
const collaboratorResponse = await github.rest.repos.checkCollaborator({
44+
owner: context.repo.owner,
45+
repo: context.repo.repo,
46+
username: username
47+
});
48+
49+
if (collaboratorResponse.status === 204) {
50+
console.log('Contributor');
51+
label = 'Prio Higher';
52+
}
5353
}
54+
} catch (error) {
55+
console.log(`Error processing user ${username}: ${error.message}`);
5456
}
5557
5658
if (label !== '') {

0 commit comments

Comments
 (0)