@@ -396,6 +396,7 @@ async function runWorkflow(options: HarnessOptions = {}) {
396396 createCommitStatus,
397397 createLabel,
398398 setFailed,
399+ info : core . info ,
399400 warning : core . warning ,
400401 getPullRequest,
401402 listPullRequests : github . rest . pulls . list ,
@@ -537,22 +538,59 @@ describe("PR review-state workflow", () => {
537538 expect ( latestGuide ( result ) ) . toContain ( "Review-state labels are managed by this workflow" )
538539 } )
539540
540- it ( "routes bot -authored PRs directly to maintainer review " , async ( ) => {
541+ it ( "starts CodeRabbit for zoomote -authored PRs after required CI passes " , async ( ) => {
541542 const result = await runWorkflow ( {
542543 prAuthor : { login : "zoomote[bot]" , type : "Bot" } ,
543544 } )
544545
546+ expect ( result . addLabels ) . toHaveBeenCalledWith ( expect . objectContaining ( { labels : [ "coderabbit-review-active" ] } ) )
547+ expect ( result . addLabels ) . toHaveBeenCalledWith ( expect . objectContaining ( { labels : [ "awaiting-coderabbit" ] } ) )
548+ expect ( latestGateStatus ( result ) ?. state ) . toBe ( "pending" )
549+ expect ( latestGateStatus ( result ) ?. description ) . toContain ( "Waiting for automated review" )
550+ expect ( result . info ) . toHaveBeenCalledWith ( expect . stringContaining ( "coderabbit=pending" ) )
551+ } )
552+
553+ it ( "does not start CodeRabbit for draft zoomote-authored PRs" , async ( ) => {
554+ const result = await runWorkflow ( {
555+ draft : true ,
556+ prAuthor : { login : "zoomote[bot]" , type : "Bot" } ,
557+ } )
558+
559+ expect ( result . addLabels ) . not . toHaveBeenCalledWith (
560+ expect . objectContaining ( { labels : [ "coderabbit-review-active" ] } ) ,
561+ )
562+ expect ( latestGuide ( result ) ) . toContain ( "Mark the PR ready" )
563+ } )
564+
565+ it ( "does not start CodeRabbit for zoomote-authored PRs while required CI fails" , async ( ) => {
566+ const result = await runWorkflow ( {
567+ prAuthor : { login : "zoomote[bot]" , type : "Bot" } ,
568+ requiredConclusion : "failure" ,
569+ } )
570+
571+ expect ( result . addLabels ) . not . toHaveBeenCalledWith (
572+ expect . objectContaining ( { labels : [ "coderabbit-review-active" ] } ) ,
573+ )
574+ expect ( latestGateStatus ( result ) ?. description ) . toContain ( "Fix the failing required CI checks" )
575+ } )
576+
577+ it ( "routes other bot-authored PRs directly to maintainer review" , async ( ) => {
578+ const result = await runWorkflow ( {
579+ prAuthor : { login : "dependabot[bot]" , type : "Bot" } ,
580+ } )
581+
545582 expect ( result . addLabels ) . toHaveBeenCalledWith ( expect . objectContaining ( { labels : [ "awaiting-maintainer" ] } ) )
546583 expect ( result . addLabels ) . not . toHaveBeenCalledWith (
547584 expect . objectContaining ( { labels : [ "coderabbit-review-active" ] } ) ,
548585 )
549586 expect ( latestGateStatus ( result ) ?. state ) . toBe ( "success" )
550587 expect ( latestGateStatus ( result ) ?. description ) . toContain ( "Awaiting fresh human maintainer" )
588+ expect ( result . info ) . toHaveBeenCalledWith ( expect . stringContaining ( "coderabbit=optional" ) )
551589 } )
552590
553- it ( "completes bot-authored PR review after human maintainer approval" , async ( ) => {
591+ it ( "completes other bot-authored PR review after human maintainer approval" , async ( ) => {
554592 const result = await runWorkflow ( {
555- prAuthor : { login : "zoomote [bot]" , type : "Bot" } ,
593+ prAuthor : { login : "dependabot [bot]" , type : "Bot" } ,
556594 permissions : { maintainer : "write" } ,
557595 reviews : [
558596 {
@@ -569,7 +607,7 @@ describe("PR review-state workflow", () => {
569607
570608 it ( "honors manually requested CodeRabbit changes on bot-authored PRs" , async ( ) => {
571609 const result = await runWorkflow ( {
572- prAuthor : { login : "zoomote [bot]" , type : "Bot" } ,
610+ prAuthor : { login : "dependabot [bot]" , type : "Bot" } ,
573611 reviews : [
574612 {
575613 login : "coderabbitai[bot]" ,
0 commit comments