In this guide

Delete a Branch

Remove a branch — the clean-up step after a merge.

Action referenceDelete

What this action does #

First, connect GitHub in Services. Then open Actions → + → GitHub and choose Delete a Branch.

What a run does

Running or testing this action deletes or removes something in your connected service.

More about this action

A pull request cannot be deleted, but the branch behind it can, and that is what the website's "Delete branch" button does after a merge. Deleting a merged branch loses nothing: the commits live on in the base branch.

The default branch and any branch a protection rule covers cannot be deleted; both answer 422. A branch that is already gone answers 422 as well, so re-running an action is safe but not silent.

Give the branch name alone, without a `refs/heads/` prefix. Names containing a slash — `feature/login` — cannot be addressed here, because the slash has to reach GitHub unescaped and this client escapes every path value.

Answers 204 with no body.

Inputs to fill in #

Open an input to choose its value. Keep a fixed value with Text, receive it from Shortcuts, ask when the action runs, or use an Earlier Step. Read how input sources work.

Owner

RequiredText

User or organisation.

This input offers a picker for repository from your connected account. You can also supply its value directly.

Example value (replace with your own):
octocat

Repository

RequiredText

Name only, without the owner and without .git.

This input offers a picker for repository from your connected account. You can also supply its value directly.

Example value (replace with your own):
Hello-World

Branch

RequiredText

Branch name, with no refs/heads/ prefix and no slashes.

This input offers a picker for branch from your connected account. You can also supply its value directly.

Example value (replace with your own):
feature-login

What comes back #

The app does not declare selectable response fields for this action. A successful operation may return no content. Inspect the run in Logs to see the service’s response.

Run it from Shortcuts #

  1. Give the action a recognizable name and tap Save.
  2. In Apple Shortcuts, add Shortcutify’s Execute Action and select the saved action.
  3. Supply any Param or File slots you bound in the inputs, then run the shortcut.

If the result is unexpected, open Logs in Shortcutify, select the run, and inspect this step’s inputs and response.

Advanced reference #

Request, permissions, and identifiers

Request: DELETE https://api.github.com/repos/{owner}/{repo}/git/refs/heads/{branch}

Action identifier: github.branches.delete.v1

Permissions declared for this action: contents:write. The account’s own access rules also apply.

InputRequest keyLocation
Ownerownerpath
Repositoryrepopath
Branchbranchpath

GitHub API reference