This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.

Clean up Expo Update branches with Expo Workflows

Edit page

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


You might publish updates to Expo 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 Expo Update branch behind. This workflow cleans up the orphaned Expo Update branch when a Git branch is deleted.

Get started

Prerequisites

3 requirements

1.

Set up Expo Update

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

Terminal
- eas update:configure

2.

Connect your GitHub repository

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

3.

Workflow file on the default branch

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

The following workflow deletes the Expo 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 Expo 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 Expo 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 Expo 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.