diff --git a/torchci/lib/getAuthorizedUsername.ts b/torchci/lib/getAuthorizedUsername.ts index 04f51bc536..82c89c05c4 100644 --- a/torchci/lib/getAuthorizedUsername.ts +++ b/torchci/lib/getAuthorizedUsername.ts @@ -2,6 +2,8 @@ import { NextApiRequest, NextApiResponse } from "next"; import { getServerSession } from "next-auth"; import { hasWritePermissionsUsingOctokit } from "./GeneralUtils"; import { getOctokitWithUserToken } from "./github"; +// Give access to people who do not have write permissions to pytorch/pytorch +import allowList from "./torchagent/allowList.json"; /** * Helper that implements the common auth logic shared by the TorchAgent @@ -61,6 +63,13 @@ export async function getAuthorizedUsername( return null; } + if (allowList.includes(user.data.login)) { + console.log( + `Authorized: User ${user.data.login} is in the flambeau allow list` + ); + return user.data.login; + } + const hasWritePermissions = await hasWritePermissionsUsingOctokit( octokit, user.data.login, diff --git a/torchci/lib/torchagent/allowList.json b/torchci/lib/torchagent/allowList.json new file mode 100644 index 0000000000..0b3653887c --- /dev/null +++ b/torchci/lib/torchagent/allowList.json @@ -0,0 +1 @@ +["saienduri"]