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
3 requirements
3 requirements
1.
Your project needs to have EAS Update configured. You can set up your project with:
- eas update:configure2.
Your EAS project must be linked to a GitHub repository. See Get started with EAS Workflows.
3.
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:
name: Branch cleanup on: ref_delete: branches: ['*', '!main'] jobs: delete-update-branch: type: branch-delete params: branch_name: ${{ github.ref_name }}
How it works
on.ref_deleteruns when a GitHub branch matching the patterns is deleted. The example above triggers on all branches exceptmain.- The
branch-deletejob deletes the EAS Update branch named${{ github.ref_name }}, the same name as the deleted Git branch. - 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.shais the default branch, not the deleted ref's last commit. See thegithubcontext reference for interpolation details onref_deleteruns.- 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
!mainor!release/**inon.ref_delete.branches.