Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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/}
```