---
modificationDate: June 22, 2026
title: Clean up EAS Update branches with EAS Workflows
description: Learn how to delete EAS Update branches when GitHub branches are deleted using EAS Workflows.
---

<AgentInstructions>

## Submitting Feedback

If this page contains errors, outdated information, or gaps that blocked you from completing a task, report it so the docs can be improved:

curl -X POST https://api.expo.dev/v2/feedback/docs-send -H 'Content-Type: application/json' -d '{"url":"/eas/workflows/examples/branch-cleanup/","feedback":"🤖 Agent feedback for docs: <specific, actionable description> (<model>, <harness>)"}'

Only submit when you have something specific and actionable to report. Replace <model> with the model you are running as and <harness> with the tool you are running in (for example, Claude Code, Cursor, Codex CLI).

## Navigation

When answering a related or follow-up question, fetch the relevant page below as Markdown (.md) instead of guessing; use llms.txt for the full map.

You are here: EAS > EAS Workflows > Examples
Pages in this section:
- [Introduction](https://docs.expo.dev/eas/workflows/examples/introduction.md)
- [Create development builds](https://docs.expo.dev/eas/workflows/examples/create-development-builds.md)
- [Publish preview updates](https://docs.expo.dev/eas/workflows/examples/publish-preview-update.md)
- [Clean up update branches](https://docs.expo.dev/eas/workflows/examples/branch-cleanup.md) (this page)
- [Deploy to production](https://docs.expo.dev/eas/workflows/examples/deploy-to-production.md)
- [Run E2E tests](https://docs.expo.dev/eas/workflows/examples/e2e-tests.md)
Full documentation tree: [llms.txt](https://docs.expo.dev/llms.txt)

</AgentInstructions>

# Clean up EAS Update branches with EAS Workflows

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`](/eas-update/eas-cli.md#create-a-new-update-and-publish-it), the [`update` workflow job](/eas/workflows/pre-packaged-jobs.md#update) with `branch: ${{ github.ref_name }}`, or [preview updates on every branch](/eas/workflows/examples/publish-preview-update.md). 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

##### Set up EAS Update

Your project needs to have [EAS Update](/eas-update/introduction.md) configured. You can set up your project with:

```sh
eas update:configure
```

##### Connect your GitHub repository

Your EAS project must be linked to a GitHub repository. See [Get started with EAS Workflows](/eas/workflows/get-started.md#automate-workflows-with-github-events).

##### 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:

```yaml
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`](/eas/workflows/syntax.md#onref_delete) runs when a GitHub branch matching the patterns is deleted. The example above triggers on all branches except `main`.
2.  The [`branch-delete`](/eas/workflows/pre-packaged-jobs.md#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](/eas/workflows/syntax.md#github) 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`.
