@@ -206,15 +206,16 @@ test("Throw error if permission is not specified", async () => {
206206 scope . done ( ) ;
207207} ) ;
208208
209- test ( "Always assign if commenter is contributor " , async ( ) => {
209+ test ( "Always assign if commenter has at least one commit " , async ( ) => {
210210 const commenter = "octocat" ;
211211 client . cfg . issues . commands . assign . warn . presence = false ;
212212
213213 const scope = nock ( "https://api.github.com" )
214214 . get ( `/repos/zulip/zulipbot/collaborators/${ commenter } ` )
215215 . reply ( 204 )
216- . get ( "/repos/zulip/zulipbot/contributors" )
217- . reply ( 200 , [ { login : "octocat" } ] )
216+ . get ( `/repos/zulip/zulipbot/commits` )
217+ . query ( { author : commenter , per_page : 1 } )
218+ . reply ( 200 , [ { sha : "dummysha123" } ] )
218219 . post ( "/repos/zulip/zulipbot/issues/69/assignees" , {
219220 assignees : [ "octocat" ] ,
220221 } )
@@ -232,8 +233,9 @@ test("Error if no assignees were added", async () => {
232233 const scope = nock ( "https://api.github.com" )
233234 . get ( `/repos/zulip/zulipbot/collaborators/${ commenter } ` )
234235 . reply ( 204 )
235- . get ( "/repos/zulip/zulipbot/contributors" )
236- . reply ( 200 , [ { login : "octocat" } ] )
236+ . get ( `/repos/zulip/zulipbot/commits` )
237+ . query ( { author : commenter , per_page : 1 } )
238+ . reply ( 200 , [ { sha : "dummysha123" } ] )
237239 . post ( "/repos/zulip/zulipbot/issues/69/assignees" , {
238240 assignees : [ "octocat" ] ,
239241 } )
@@ -252,7 +254,8 @@ test("Assign if claim limit validation passed", async () => {
252254 const scope = nock ( "https://api.github.com" )
253255 . get ( `/repos/zulip/zulipbot/collaborators/${ commenter } ` )
254256 . reply ( 204 )
255- . get ( "/repos/zulip/zulipbot/contributors" )
257+ . get ( `/repos/zulip/zulipbot/commits` )
258+ . query ( { author : commenter , per_page : 1 } )
256259 . reply ( 200 , [ ] )
257260 . get ( "/issues?filter=all&labels=in%20progress" )
258261 . reply ( 200 , [ ] )
@@ -276,7 +279,8 @@ test("Reject claim limit validation failed", async () => {
276279 const scope = nock ( "https://api.github.com" )
277280 . get ( `/repos/zulip/zulipbot/collaborators/${ commenter } ` )
278281 . reply ( 204 )
279- . get ( "/repos/zulip/zulipbot/contributors" )
282+ . get ( `/repos/zulip/zulipbot/commits` )
283+ . query ( { author : commenter , per_page : 1 } )
280284 . reply ( 200 , [ ] )
281285 . get ( "/issues?filter=all&labels=in%20progress" )
282286 . reply ( 200 , [ { assignees : [ { login : "octocat" } ] } ] )
@@ -297,7 +301,8 @@ test("Reject claim limit validation failed (limit over 1)", async () => {
297301 const scope = nock ( "https://api.github.com" )
298302 . get ( `/repos/zulip/zulipbot/collaborators/${ commenter } ` )
299303 . reply ( 204 )
300- . get ( "/repos/zulip/zulipbot/contributors" )
304+ . get ( `/repos/zulip/zulipbot/commits` )
305+ . query ( { author : commenter , per_page : 1 } )
301306 . reply ( 200 , [ ] )
302307 . get ( "/issues?filter=all&labels=in%20progress" )
303308 . reply ( 200 , [
0 commit comments