11import { getDynamoClient } from "lib/dynamo" ;
22import { Context , Probot } from "probot" ;
33import { v4 as uuidv4 } from "uuid" ;
4+ import { isPyTorchbotSupportedOrg , isVLLM } from "./utils" ;
45
56async function handleWorkflowJob (
67 event : Context < "workflow_run" | "workflow_job" >
78) {
8- // Thre is the chance that job ids from different repos could collide. To
9+ const owner = event . payload . repository . owner . login ;
10+ if ( ! isPyTorchbotSupportedOrg ( owner ) && ! isVLLM ( owner ) ) {
11+ event . log ( `${ __filename } isn't enabled on ${ owner } 's repos` ) ;
12+ return ;
13+ }
14+
15+ // There is the chance that job ids from different repos could collide. To
916 // prevent this, prefix the object key with the repo that they come from.
1017 const key_prefix = event . payload . repository . full_name + "/" ;
1118
@@ -35,6 +42,12 @@ async function handleWorkflowJob(
3542}
3643
3744async function handleIssues ( event : Context < "issues" > ) {
45+ const owner = event . payload . repository . owner . login ;
46+ if ( ! isPyTorchbotSupportedOrg ( owner ) && ! isVLLM ( owner ) ) {
47+ event . log ( `${ __filename } isn't enabled on ${ owner } 's repos` ) ;
48+ return ;
49+ }
50+
3851 const client = getDynamoClient ( ) ;
3952
4053 const issue_number = event . payload . issue . number ;
@@ -69,6 +82,12 @@ async function handleIssues(event: Context<"issues">) {
6982}
7083
7184async function handleIssueComment ( event : Context < "issue_comment" > ) {
85+ const owner = event . payload . repository . owner . login ;
86+ if ( ! isPyTorchbotSupportedOrg ( owner ) && ! isVLLM ( owner ) ) {
87+ event . log ( `${ __filename } isn't enabled on ${ owner } 's repos` ) ;
88+ return ;
89+ }
90+
7291 const key_prefix = event . payload . repository . full_name ;
7392 const client = getDynamoClient ( ) ;
7493
@@ -82,6 +101,12 @@ async function handleIssueComment(event: Context<"issue_comment">) {
82101}
83102
84103async function handlePullRequest ( event : Context < "pull_request" > ) {
104+ const owner = event . payload . repository . owner . login ;
105+ if ( ! isPyTorchbotSupportedOrg ( owner ) && ! isVLLM ( owner ) ) {
106+ event . log ( `${ __filename } isn't enabled on ${ owner } 's repos` ) ;
107+ return ;
108+ }
109+
85110 const key_prefix = event . payload . repository . full_name + "/" ;
86111 const client = getDynamoClient ( ) ;
87112
@@ -117,6 +142,12 @@ async function handlePullRequest(event: Context<"pull_request">) {
117142}
118143
119144async function handlePush ( event : Context < "push" > ) {
145+ const owner = event . payload . repository . owner . login ;
146+ if ( ! isPyTorchbotSupportedOrg ( owner ) && ! isVLLM ( owner ) ) {
147+ event . log ( `${ __filename } isn't enabled on ${ owner } 's repos` ) ;
148+ return ;
149+ }
150+
120151 const key_prefix = event . payload . repository . full_name + "/" ;
121152 const client = getDynamoClient ( ) ;
122153
@@ -130,6 +161,12 @@ async function handlePush(event: Context<"push">) {
130161}
131162
132163async function handlePullRequestReview ( event : Context < "pull_request_review" > ) {
164+ const owner = event . payload . repository . owner . login ;
165+ if ( ! isPyTorchbotSupportedOrg ( owner ) && ! isVLLM ( owner ) ) {
166+ event . log ( `${ __filename } isn't enabled on ${ owner } 's repos` ) ;
167+ return ;
168+ }
169+
133170 const key_prefix = event . payload . repository . full_name ;
134171 const client = getDynamoClient ( ) ;
135172
@@ -145,6 +182,12 @@ async function handlePullRequestReview(event: Context<"pull_request_review">) {
145182async function handlePullRequestReviewComment (
146183 event : Context < "pull_request_review_comment" >
147184) {
185+ const owner = event . payload . repository . owner . login ;
186+ if ( ! isPyTorchbotSupportedOrg ( owner ) && ! isVLLM ( owner ) ) {
187+ event . log ( `${ __filename } isn't enabled on ${ owner } 's repos` ) ;
188+ return ;
189+ }
190+
148191 const key_prefix = event . payload . repository . full_name ;
149192 const client = getDynamoClient ( ) ;
150193
0 commit comments