https://github.com/julbme/gh-action-manage-branch
GitHub Action to manage branches
https://github.com/julbme/gh-action-manage-branch
branch ci create delete github-action
Last synced: about 1 year ago
JSON representation
GitHub Action to manage branches
- Host: GitHub
- URL: https://github.com/julbme/gh-action-manage-branch
- Owner: julbme
- License: mit
- Created: 2022-02-17T12:04:20.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-12-03T21:04:14.000Z (over 3 years ago)
- Last Synced: 2025-02-21T13:48:19.787Z (over 1 year ago)
- Topics: branch, ci, create, delete, github-action
- Language: Java
- Homepage: https://julbme.github.io/gh-action-manage-branch/
- Size: 632 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/julbme/gh-action-manage-branch/actions/workflows/maven-build.yml)
[](https://github.com/julbme/gh-action-manage-branch/actions/workflows/commitlint.yml)
[](https://sonarcloud.io/summary/new_code?id=julbme_gh-action-manage-branch)

# GitHub Action to manage branches
The GitHub Action for managing branches of the GitHub repository.
- Create a new branch
- Move the branch to another commit
- Delete a branch
## Usage
### Example Workflow file
- Create a branch:
```yaml
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Create/Update the branch
uses: julbme/gh-action-manage-branch@v1
with:
name: branch-name
state: present
from: ${{ github.ref }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
- Delete a branch
```yaml
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Delete the branch
uses: julbme/gh-action-manage-branch@v1
with:
name: branch-name
state: absent
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
### Inputs
| Name | Type | Default | Description |
|---------|--------|--------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `name` | string | `Not set` | Name of the branch. **Required** |
| `state` | string | `present` | Expected state of the branch. Valid values are `present` to create the branch or `absent` to delete the branch |
| `from` | string | `github.sha` | The reference from which to create or update the branch - could be a branch, a tag, a ref or a specific SHA. By default, it takes the commit that triggered the workflow. |
### Outputs
| Name | Type | Description |
|--------|--------|--------------------------------------------------------------------------------|
| `ref` | string | Git ref of the branch `refs/heads/name`, or ` ` in case the branch is deleted. |
| `name` | string | Name of the branch, or ` ` in case the branch is deleted. |
| `sha` | sha | SHA Commit of the branch, or ` ` in case the branch is deleted. |
## Contributing
This project is totally open source and contributors are welcome.