diff --git a/dist/index.js b/dist/index.js index 7181be2..5311eae 100644 --- a/dist/index.js +++ b/dist/index.js @@ -8939,8 +8939,17 @@ function getCommandsFromComment(body) { exports.getCommandsFromComment = getCommandsFromComment; function inTeam(org, username, team) { return __awaiter(this, void 0, void 0, function* () { - const members = yield octokit_1.default.teams.listMembersInOrg({ org, team_slug: team }); - return members.data.map(m => m.login).includes(username); + try { + const members = yield octokit_1.default.teams.listMembersInOrg({ org, team_slug: team }); + return members.data.map(m => m.login).includes(username); + } + catch (e) { + if (e.status === 404) { + console.warn(`404 while fetching members of '${team}' team`); + return false; + } + throw e; + } }); } exports.inTeam = inTeam; diff --git a/src/bot.ts b/src/bot.ts index 9df106d..001d24c 100644 --- a/src/bot.ts +++ b/src/bot.ts @@ -39,9 +39,18 @@ export function getCommandsFromComment(body: string): Command[] { } export async function inTeam(org: string, username: string, team: string) { - const members = await octokit.teams.listMembersInOrg({ org, team_slug: team }); + try { + const members = await octokit.teams.listMembersInOrg({ org, team_slug: team }); + + return members.data.map(m => m.login).includes(username); + } catch (e) { + if ((e as RequestError).status === 404) { + console.warn(`404 while fetching members of '${team}' team`); + return false; + } - return members.data.map(m => m.login).includes(username); + throw e; + } } export async function isMaintainer(org: string, username: string) {