File tree Expand file tree Collapse file tree
apps/docs/src/app/api/github-webhook Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,16 +33,20 @@ export async function POST(req: Request) {
3333
3434 const isMember = pr . author_association === "MEMBER" ;
3535
36- const teamRes = await fetch (
37- `https://api.github.com/orgs/prisma/teams/dev-connections-write/memberships/${ pr . user . login } ` ,
38- {
39- headers : {
40- Authorization : `Bearer ${ process . env . BOT_TOKEN_GITHUB_PR_LINEAR_WEBHOOK ! } ` ,
41- "X-GitHub-Api-Version" : "2022-11-28" ,
42- } ,
43- }
36+ const teamSlugs = [ "dev-connections-write" , "webdev-write" ] as const ;
37+ const authHeaders = {
38+ Authorization : `Bearer ${ process . env . BOT_TOKEN_GITHUB_PR_LINEAR_WEBHOOK ! } ` ,
39+ "X-GitHub-Api-Version" : "2022-11-28" ,
40+ } as const ;
41+ const membershipResults = await Promise . all (
42+ teamSlugs . map ( ( slug ) =>
43+ fetch (
44+ `https://api.github.com/orgs/prisma/teams/${ encodeURIComponent ( slug ) } /memberships/${ encodeURIComponent ( pr . user . login ) } ` ,
45+ { headers : authHeaders }
46+ )
47+ )
4448 ) ;
45- const isTeamMember = teamRes . status === 200 ;
49+ const isTeamMember = membershipResults . some ( ( r ) => r . status === 200 ) ;
4650
4751 if ( isMember || isTeamMember ) {
4852 return new Response ( "Internal contributor, skipping" , { status : 200 } ) ;
You can’t perform that action at this time.
0 commit comments