Explorer

definy.branch-statuses

description
The status of each branch other than main (core.branch-summary-status) from the snapshots (definy.read-snapshots) and the status events (definy.read-branch-status-records), in the order of core.project-branches
type
Fn(commits: List<@definy.event-snapshot>, records: List<@core.branch-status-record>) -> List<Record{project_name: String, branch: String, status: @core.branch-status}>
expression
fn(commits$0, records$1) =>
  let merges$2 = @definy.branch-merges(commits: $0);
  @core.list-fold(
    T: @core.branch-summary,
    A: List<Record{project_name: String, branch: String, status: @core.branch-status}>,
    reducer: fn(acc$3, item$4) =>
      match @core.branch-summary-status(branch: $4, records: $1, merges: $2) {
        #none(_) =>
          $3,
        #some(status$5) =>
          @core.list-append(list: $3, item: {project_name: $4.project_name, branch: $4.name, status: $5})
      },
    init: [],
    xs: @core.project-branches(
      commits: @core.list-map(
        T: @definy.event-snapshot,
        U: @core.snapshot-summary,
        f: fn(item$6) =>
          @definy.snapshot-summary-of(commit: $6),
        xs: $0
      )
    )
  )
visibility
public
definy.branch-statuses (project definy, branch main, snapshot l0VFjJZP174d8CbZWFoujAGTYjgsQu4uTq5uWCZaXgo)
id: idyUmAmSFfobibPkStYwd42kYcM53MycmITyWJCLZNE
content hash: 5LFYi3bRwsZBsIbu6UPVxVQw3LF0BWJvLf4YBrURgdE