Explorer

core.event-check-state-of-branch

description
What the rules know about an event on an existing branch that is not a snapshot (project_branch_status): the latest snapshot of the branch (none if there is no such branch), whether the account created the branch, and whether the project has any snapshot. The fields only for snapshots are false or empty
type
Fn(project_name: String, branch: String, facts: @core.event-check-facts) -> @core.event-check-state
expression
fn(project_name$0, branch$1, facts$2) =>
  let commits$3 = $2.commits;
  {
    account_created: $2.account_created,
    branch_latest_commit_hash: match @core.branch-latest-snapshot(commits: $3, project_name: $0, branch: $1, index: 0, found: #none) {
      #none(_) =>
        #none,
      #some(latest$4) =>
        #some($4.event_hash)
    },
    is_branch_creator: match @core.branch-first-snapshot(commits: $3, project_name: $0, branch: $1, index: 0, found: #none) {
      #none(_) =>
        false,
      #some(first$5) =>
        @core.equal(left: $5.account_id, right: $2.account_id)
    },
    merged_in_project: false,
    modules_in_other_projects: [],
    parent_in_project: false,
    project_has_commits: @core.project-has-snapshot(commits: $3, project_name: $0, hash: #none, index: 0)
  }
visibility
public
core.event-check-state-of-branch (project definy, branch main, snapshot l0VFjJZP174d8CbZWFoujAGTYjgsQu4uTq5uWCZaXgo)
id: N7rl-Coh7lrCup_xQJCqB8y_K3OFPjp3lIx5hG-cNIo
content hash: sWI-VTqDhRerfZKfx2-mqgNMJRvsaytLuLS7tiJrcRM