try catch labeler rest api
This commit is contained in:
8
.github/workflows/labeler.yml
vendored
8
.github/workflows/labeler.yml
vendored
@@ -28,6 +28,7 @@ jobs:
|
|||||||
issueOrPrNumber = context.payload.pull_request.number;
|
issueOrPrNumber = context.payload.pull_request.number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
// Check for Adafruit membership
|
// Check for Adafruit membership
|
||||||
const adafruitResponse = await github.rest.orgs.checkMembershipForUser({
|
const adafruitResponse = await github.rest.orgs.checkMembershipForUser({
|
||||||
org: 'adafruit',
|
org: 'adafruit',
|
||||||
@@ -38,7 +39,7 @@ jobs:
|
|||||||
console.log('Adafruit Member');
|
console.log('Adafruit Member');
|
||||||
label = 'Prio Urgent';
|
label = 'Prio Urgent';
|
||||||
} else {
|
} else {
|
||||||
// Check if the user is a contributor
|
// If not a Adafruit member, check if the user is a contributor
|
||||||
const collaboratorResponse = await github.rest.repos.checkCollaborator({
|
const collaboratorResponse = await github.rest.repos.checkCollaborator({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
@@ -48,10 +49,11 @@ jobs:
|
|||||||
if (collaboratorResponse.status === 204) {
|
if (collaboratorResponse.status === 204) {
|
||||||
console.log('Contributor');
|
console.log('Contributor');
|
||||||
label = 'Prio Higher';
|
label = 'Prio Higher';
|
||||||
} else {
|
|
||||||
console.log('Not a contributor or Adafruit member');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(`Error processing user ${username}: ${error.message}`);
|
||||||
|
}
|
||||||
|
|
||||||
if (label !== '') {
|
if (label !== '') {
|
||||||
await github.rest.issues.addLabels({
|
await github.rest.issues.addLabels({
|
||||||
|
Reference in New Issue
Block a user