summaryrefslogtreecommitdiff
path: root/.github/workflows
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2024-04-03 13:09:24 +0700
committerGitHub <[email protected]>2024-04-03 13:09:24 +0700
commitb8d4684683cc0e8231c7c8f9608e6e32ed17ec11 (patch)
treec6f6dc529edac2a2ba614f10824c827783d077d0 /.github/workflows
parent60acb990b608b2c97214f75d5aa8dc169e0e663e (diff)
parent252e630433ff62f9b3ee010f576b5e42e6d7d1e2 (diff)
Merge pull request #2569 from hathach/fix-labler-error
try catch labeler rest api
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/labeler.yml38
1 files changed, 20 insertions, 18 deletions
diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml
index 4733c6f06..947b08ca2 100644
--- a/.github/workflows/labeler.yml
+++ b/.github/workflows/labeler.yml
@@ -28,29 +28,31 @@ jobs:
issueOrPrNumber = context.payload.pull_request.number;
}
- // Check for Adafruit membership
- const adafruitResponse = await github.rest.orgs.checkMembershipForUser({
- org: 'adafruit',
- username: username
- });
-
- if (adafruitResponse.status === 204) {
- console.log('Adafruit Member');
- label = 'Prio Urgent';
- } else {
- // Check if the user is a contributor
- const collaboratorResponse = await github.rest.repos.checkCollaborator({
- owner: context.repo.owner,
- repo: context.repo.repo,
+ try {
+ // Check for Adafruit membership
+ const adafruitResponse = await github.rest.orgs.checkMembershipForUser({
+ org: 'adafruit',
username: username
});
- if (collaboratorResponse.status === 204) {
- console.log('Contributor');
- label = 'Prio Higher';
+ if (adafruitResponse.status === 204) {
+ console.log('Adafruit Member');
+ label = 'Prio Urgent';
} else {
- console.log('Not a contributor or Adafruit member');
+ // If not a Adafruit member, check if the user is a contributor
+ const collaboratorResponse = await github.rest.repos.checkCollaborator({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ username: username
+ });
+
+ if (collaboratorResponse.status === 204) {
+ console.log('Contributor');
+ label = 'Prio Higher';
+ }
}
+ } catch (error) {
+ console.log(`Error processing user ${username}: ${error.message}`);
}
if (label !== '') {