@@ -1578,18 +1578,16 @@ export const make = Effect.gen(function* () {
15781578 ) ,
15791579 ) ,
15801580 listActionRequiredRuns ( input ) . pipe (
1581- Effect . flatMap ( ( runs ) =>
1582- runs . length > workflowApprovalLimit
1583- ? Effect . fail (
1584- new GitHubWorkflowApprovalRefusedError ( {
1585- cwd : input . cwd ,
1586- number : input . number ,
1587- reason : "run-list-truncated" ,
1588- observedCount : runs . length ,
1589- limit : workflowApprovalLimit ,
1590- } ) ,
1591- )
1592- : Effect . succeed ( runs ) ,
1581+ Effect . filterOrFail (
1582+ ( runs ) => ! ( runs . length > workflowApprovalLimit ) ,
1583+ ( runs ) =>
1584+ new GitHubWorkflowApprovalRefusedError ( {
1585+ cwd : input . cwd ,
1586+ number : input . number ,
1587+ reason : "run-list-truncated" ,
1588+ observedCount : runs . length ,
1589+ limit : workflowApprovalLimit ,
1590+ } ) ,
15931591 ) ,
15941592 ) ,
15951593 ] ,
@@ -1836,40 +1834,41 @@ export const make = Effect.gen(function* () {
18361834 ( batch ) => batch . items . length > 0 || input . cursor !== undefined || hasQuery ,
18371835 ( ) => read ( false ) ,
18381836 ) ,
1839- Effect . flatMap ( ( batch ) => {
1840- if ( ! stacks || batch . items . length === 0 ) return Effect . succeed ( batch ) ;
1841- return Effect . forEach (
1842- batch . items ,
1843- ( item ) => {
1844- const lookup = pullRequestLookup ( {
1845- repository : input . repository ,
1846- number : item . number ,
1847- } ) ;
1848- if ( lookup === null ) return Effect . succeed ( item ) ;
1849- return GraphQLResolver . request ( lookup , stackMembershipResolver ) . pipe (
1850- Effect . map ( ( result ) => {
1851- const pullRequest = result . repository ?. pullRequest ;
1852- const stack = pullRequest == null ? undefined : toStackMembership ( pullRequest ) ;
1853- return stack === undefined ? item : { ...item , stack } ;
1854- } ) ,
1855- Effect . catch ( ( error ) =>
1856- Effect . logWarning ( "Pull request stack membership enrichment failed" , {
1857- operation : "listPullRequestStackMemberships" ,
1858- host : input . host ,
1859- error : error . _tag ,
1860- } ) . pipe ( Effect . as ( item ) ) ,
1861- ) ,
1862- ) ;
1863- } ,
1864- { concurrency : "unbounded" } ,
1865- ) . pipe (
1866- Effect . provideService ( GitHubGraphQlClient . GitHubGraphQlTarget , {
1867- host : input . host ,
1868- operation : "listPullRequestStackMemberships" ,
1869- } ) ,
1870- Effect . map ( ( items ) => ( { ...batch , items } ) ) ,
1871- ) ;
1872- } ) ,
1837+ Effect . filterOrElse (
1838+ ( batch ) => ! stacks || batch . items . length === 0 ,
1839+ ( batch ) =>
1840+ Effect . forEach (
1841+ batch . items ,
1842+ ( item ) => {
1843+ const lookup = pullRequestLookup ( {
1844+ repository : input . repository ,
1845+ number : item . number ,
1846+ } ) ;
1847+ if ( lookup === null ) return Effect . succeed ( item ) ;
1848+ return GraphQLResolver . request ( lookup , stackMembershipResolver ) . pipe (
1849+ Effect . map ( ( result ) => {
1850+ const pullRequest = result . repository ?. pullRequest ;
1851+ const stack = pullRequest == null ? undefined : toStackMembership ( pullRequest ) ;
1852+ return stack === undefined ? item : { ...item , stack } ;
1853+ } ) ,
1854+ Effect . catch ( ( error ) =>
1855+ Effect . logWarning ( "Pull request stack membership enrichment failed" , {
1856+ operation : "listPullRequestStackMemberships" ,
1857+ host : input . host ,
1858+ error : error . _tag ,
1859+ } ) . pipe ( Effect . as ( item ) ) ,
1860+ ) ,
1861+ ) ;
1862+ } ,
1863+ { concurrency : "unbounded" } ,
1864+ ) . pipe (
1865+ Effect . provideService ( GitHubGraphQlClient . GitHubGraphQlTarget , {
1866+ host : input . host ,
1867+ operation : "listPullRequestStackMemberships" ,
1868+ } ) ,
1869+ Effect . map ( ( items ) => ( { ...batch , items } ) ) ,
1870+ ) ,
1871+ ) ,
18731872 ) ;
18741873 } ,
18751874
0 commit comments