A lightweight GitHub Action that automatically creates branches when issues are created. Features intelligent name sanitization, German umlaut conversion, automatic issue linking, and robust duplicate handling.
- Automated Branch Creation – Creates branches automatically when issues are opened
- Automatic Issue Linking – Links branches to issues in the Development section (GraphQL)
- Custom Prefixes – Add custom prefixes like "feature/" or "bugfix/"
- Duplicate Handling – Appends numeric suffixes (-1, -2, etc.) for duplicate branch names
- Enterprise Support – Works with GitHub Enterprise Server
- German Umlaut Support – Converts ä→ae, ö→oe, ü→ue, ß→ss
- Issue Comments – Optionally post branch name to issue as comment
- Label-Based Prefixes – Optionally use issue labels as branch prefixes
- Skip Labels – Prevent branch creation for specific labels
- Smart Sanitization – Removes special characters, normalizes spacing, enforces lowercase
name: Create Branch on Issue
on:
issues:
types: [opened]
jobs:
create-branch:
permissions:
contents: write
issues: write
runs-on: ubuntu-latest
steps:
- name: Create branch from issue
uses: lukas-kuntze/devx-action-branch-on-issue@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}| Input | Description | Required | Default |
|---|---|---|---|
add_comment |
Add comment to issue with branch name | ❌ No | true |
base_branch |
Base branch to create new branches from | ❌ No | main |
branch_prefix |
Custom prefix for branch names (e.g., "feature") | ❌ No | '' |
github_token |
GitHub token for authentication | ✅ Yes | - |
link_to_issue |
Link branch to issue in Development section | ❌ No | true |
max_length |
Maximum branch name length | ❌ No | 100 |
skip_labels |
Comma-separated labels to skip branch creation | ❌ No | '' |
use_label_prefix |
Use first issue label as branch prefix | ❌ No | false |
| Output | Description |
|---|---|
branch_name |
Final name of the created branch |
linked_to_issue |
Whether the branch was successfully linked to the issue |
original_name |
Sanitized name before duplicate handling |
was_duplicate |
Whether the branch name was modified due to duplication |
- name: Create branch from issue
uses: lukas-kuntze/devx-action-branch-on-issue@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}Issue: FEAT-789 Neue Suchfunktion für Übersicht
Branch: feat-789-neue-suchfunktion-fuer-uebersicht
- name: Create feature branch
uses: lukas-kuntze/devx-action-branch-on-issue@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch_prefix: featureIssue: Add user authentication
Branch: feature/add-user-authentication
- name: Create branch with label prefix
uses: lukas-kuntze/devx-action-branch-on-issue@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
use_label_prefix: trueIssue: Implement dark mode
Labels: enhancement, ui
Branch: enhancement/implement-dark-mode
- name: Create branch (skip certain labels)
uses: lukas-kuntze/devx-action-branch-on-issue@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
skip_labels: 'wontfix, duplicate, invalid'Skips branch creation if issue has any of these labels.
- name: Create branch from develop
uses: lukas-kuntze/devx-action-branch-on-issue@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
base_branch: develop- name: Create branch silently
uses: lukas-kuntze/devx-action-branch-on-issue@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
add_comment: false- name: Create short branch names
uses: lukas-kuntze/devx-action-branch-on-issue@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
max_length: 50- name: Create branch without linking
uses: lukas-kuntze/devx-action-branch-on-issue@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
link_to_issue: falseCreates branch via REST API without linking to issue.
The action performs the following transformations:
- Convert Umlauts –
ä→ae,ö→oe,ü→ue,ß→ss,Ä→Ae,Ö→Oe,Ü→Ue - Lowercase – Convert entire string to lowercase
- Normalize Spacing – Replace spaces and underscores with hyphens
- Remove Special Characters – Keep only
a-z,0-9,-,/ - Collapse Hyphens – Replace multiple consecutive hyphens with single hyphen
- Trim Hyphens – Remove leading and trailing hyphens
- Add Prefix – Add custom or label-based prefix (optional)
- Truncate – Limit to maximum length (default: 100 characters)
| Input | Output |
|---|---|
FEAT-789 Neue Suchfunktion für Übersicht |
feat-789-neue-suchfunktion-fuer-uebersicht |
Feature: Neue Übersicht für Benutzer |
feature-neue-uebersicht-fuer-benutzer |
Fix Bug in Größenberechnung |
fix-bug-in-groessenberechnung |
Add User Authentication & Authorization |
add-user-authentication-authorization |
If a branch with the sanitized name already exists, the action automatically appends a numeric suffix:
- First duplicate:
branch-name-1 - Second duplicate:
branch-name-2 - Third duplicate:
branch-name-3 - And so on...
Example:
| Attempt | Branch Name |
|---|---|
| 1st issue | fix-login-bug |
| 2nd issue (duplicate) | fix-login-bug-1 |
| 3rd issue (duplicate) | fix-login-bug-2 |
By default, the action links created branches to issues in the Development section using GitHub's GraphQL API.
Benefits:
- Branches appear in the issue's Development section
- Automatic tracking of related branches and PRs
- Better visibility in GitHub UI
How it works:
- If
link_to_issue: true(default), uses GraphQLcreateLinkedBranchmutation - If GraphQL fails, falls back to REST API (branch created without linking)
- If
link_to_issue: false, uses REST API directly
Example with linking disabled:
- name: Create branch without linking
uses: lukas-kuntze/devx-action-branch-on-issue@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
link_to_issue: false- name: Create branch (Enterprise)
uses: lukas-kuntze/devx-action-branch-on-issue@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
github_api_url: 'https://github.company.com/api/v3'- Read Inputs – Loads configuration from action inputs
- Validate – Ensures token, base branch, and max length are valid
- Extract Issue Context – Gets issue number, title, labels, and author
- Check Skip Labels – Skips branch creation if issue has skip labels
- Sanitize Name – Converts title to valid Git branch name
- Check Duplicates – Appends numeric suffix if branch exists
- Create Branch – Creates branch via GraphQL (with linking) or REST API (fallback)
- Add Comment – Posts branch name to issue (optional)
- Set Outputs – Provides branch name and metadata
contents: writepermission (to create branches)issues: writepermission (to add comments, if enabled)- Triggered by
issuesevent withopenedtype
Created and maintained by Lukas Kuntze
Software Developer · Software Development & IT Services Kuntze
GitHub: lukas-kuntze