Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yanamura/git-flow-merge-action
https://github.com/yanamura/git-flow-merge-action
git-flow git-merge gitflow github-actions
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/yanamura/git-flow-merge-action
- Owner: yanamura
- License: mit
- Created: 2020-05-19T14:55:25.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-08-06T08:10:23.000Z (5 months ago)
- Last Synced: 2024-10-15T12:34:40.898Z (3 months ago)
- Topics: git-flow, git-merge, gitflow, github-actions
- Language: TypeScript
- Size: 1.28 MB
- Stars: 15
- Watchers: 2
- Forks: 1
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Git-flow Merge
This action merge specified branch to `develop` and `master` branch, and add tag.
If you're using `release branch` or `hotfix branch` of [gitflow-workflow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow) on your project, this action will help you when release or hotfix branch is ready to ship.
## Usage
```yaml
- uses: actions/checkout@v3
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Extract tag name
shell: bash
run: |
branch=${{ steps.extract_branch.outputs.branch }}
echo "##[set-output name=tag;]$(echo ${branch#release/})"
id: extract_tag
- uses: yanamura/git-flow-merge-action@v1
with:
### GITHUB_TOKEN.(required)
github_token: ${{ secrets.GITHUB_TOKEN }}### branch name which merged to develop and master branch.(required)
### ex. release/1.1.0, hotfix_branch
branch: ${{ steps.extract_branch.outputs.branch }}### develop branch name. default: develop (optional).
develop_branch: 'dev'### main branch name. default: master (optional).
main_branch: 'main'### tag name which tagged to master.(optional)
### ex. v1.1.0
tag: v${{ steps.extract_tag.outputs.tag }}
```## How to get branch name
### when trigger is pull_request
use [mdecoleman/pr-branch-name](https://github.com/mdecoleman/pr-branch-name) to get branch name.
```yaml
on:
pull_request:
types: [labeled]
jobs:
automerge:
if: github.event.label.name == 'release'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Extract branch name
uses: mdecoleman/[email protected]
id: extract_branch
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: yanamura/git-flow-merge-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ steps.extract_branch.outputs.branch }}
```### when trigger is not pull_request
use [GITHUB_REF](https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables#default-environment-variables)
```
${GITHUB_REF#refs/heads/}
``````yaml
on:
create
jobs:
automerge:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: yanamura/git-flow-merge-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${GITHUB_REF#refs/heads/}
```