Dark mode
Merge a task branch

Merge a task branch

The Merge into action merges a task's working branch into another branch when a flow runs. Use it to ship work that has already been reviewed, for example to merge an agent's branch into main as soon as its run is approved.

Before you start

  • The task needs a working branch and a repository. These are set when an agent works on the task with a connected repository.

  • The repository must be connected through GitHub. Merging is done through the GitHub App.

  • Protect important branches in GitHub as usual. The merge is subject to your repository's rules.

When you can use it

This action is available with the two workflow triggers:

  • Task enters a workflow state – for example, merge when a task moves to Ready to Release.

  • Interactive run is approved – for example, merge when a reviewer approves the agent's run.

Set up the action

  1. Go to Automation → Flows and create or edit a flow.

  2. In the When row, choose Task enters a workflow state or Interactive run is approved.

  3. In the if row, choose the workflow and the state.

  4. In the then row, choose Merge into.

  5. After into branch, enter the branch to merge into, such as main. To use the task's own base branch, enter {base_branch}.

  6. Select Create flow or Save changes.

If you leave the branch empty, the composer shows “Enter the branch to merge into” and you can't save.

What happens when it runs

  • Helpin merges the task's working branch into the branch you entered, with a commit message such as “Merge working-branch into main”.

  • The task's delivery status changes to merged, and the task's activity records the merge.

  • If the task has no working branch or repository, or you used {base_branch} and the task has no base branch, the flow skips the merge.

If the merge doesn't happen

A merge can fail, for example because of a conflict or a branch protection rule. The flow doesn't retry. Check the task's delivery status and the repository in GitHub, resolve the problem, and merge manually or move the task through the flow again.

Was this article helpful?