Skip to content

sync() ​

Merge the released branch into the branches of its rules of sync from code, and know what was done to each branch.

Signature ​

ts
function sync(options?: SyncOptions): Promise<SyncResult>

Options: SyncOptions. Result: SyncResult, one SyncBranchResult per branch.

Behavior ​

  • Does what relizy sync does: the branches of the rules whose from matches the released branch; branches, mode and from are its --to, --sync-mode and --from.
  • Resolves with what was done to each branch, and with which mode: merged, fast-forward, up-to-date or pull-request (with its number and url, existing when it was already open). When no rule matches and branches is not given, branches is empty.
  • Rejects with a SyncError when a branch did not get the release (conflict, with its conflicts and the commands in reason, or failed), after the other branches are synced: its result holds every branch.
  • dryRun fetches the branches and computes the merges: nothing is pushed nor opened.
  • In release(), the same sync runs after the push, and a branch that does not get the release never rejects it: see sync in the ReleaseReport.

Example ​

ts
import { sync, SyncError } from 'relizy'

try {
  const result = await sync({ branches: ['develop'] })
  console.log(result.branches.map(branch => `${branch.branch}: ${branch.status}`))
}
catch (error) {
  if (error instanceof SyncError) {
    console.error(error.result.branches.filter(branch => branch.status === 'conflict'))
  }
  throw error
}

See Also ​