Clean up EAS Update branches with EAS Workflows

Edit page

Learn how to delete EAS Update branches when GitHub branches are deleted using EAS Workflows.


You might publish updates to EAS Update branches named after GitHub branches, for example with eas update --auto, the update workflow job with branch: ${{ github.ref_name }}, or preview updates on every branch. When you do, deleting the GitHub branch leaves the EAS Update branch behind. This workflow cleans up the orphaned EAS Update branch when a Git branch is deleted.

Get started

Prerequisites

3 requirements

1.

Set up EAS Update

Your project needs to have EAS Update configured. You can set up your project with:

Terminal
eas update:configure

2.

Connect your GitHub repository

Your EAS project must be linked to a GitHub repository. See Get started with EAS Workflows.

3.

Workflow file on the default branch

Keep this workflow file on your repository's default branch. When a branch is deleted, EAS reads workflow configuration from the default branch HEAD, not from the deleted ref.

The following workflow deletes the EAS Update branch with the same name as the deleted GitHub branch:

.eas/workflows/branch-cleanup.yml
name: Branch cleanup on: ref_delete: branches: ['*', '!main'] jobs: delete-update-branch: type: branch-delete params: branch_name: ${{ github.ref_name }}

How it works

  1. on.ref_delete runs when a GitHub branch matching the patterns is deleted. The example above triggers on all branches except main.
  2. The branch-delete job deletes the EAS Update branch named ${{ github.ref_name }}, the same name as the deleted Git branch.
  3. With the default fail_on_missing: false, the job succeeds even if the EAS Update branch was already deleted or never existed.

Important notes

  • github.sha is the default branch, not the deleted ref's last commit. See the github context reference for interpolation details on ref_delete runs.
  • Channel mappings block deletion: if a channel points to the EAS Update branch, deletion fails with an error about the channel mapping.
  • Protect branches you never want cleaned up using negation patterns like !main or !release/** in on.ref_delete.branches.