Skip to content

Commit

Permalink
feat: Option to commit merge changes (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
shrink authored Jul 17, 2021
1 parent f276245 commit 701d2a3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pr-mpt/actions-merge-branch@v1
| **`from`** | **Branch to merge into the current branch** | **<kbd>required</kbd>** | **`main`** |
| `author` | Merge commit author | GitHub Actions<sup>[1]</sup> | `Alice <[email protected]>` |
| `strategy` | Merge strategy with options | `recursive -Xtheirs` | `recursive`<br/>`recursive -Xours` |
| `commit` | Commit changes? | `true` | `true` `false` |
| `push` | Push merge commit to origin? | `true` | `true` `false` |

[1] [`github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>`][users/github-actions]
Expand Down
13 changes: 12 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ inputs:
from:
description: "Branch to merge into the current branch"
required: true
commit:
description: "Commit changes?"
default: "true"
required: true
author:
description: "Commit author in Git author format"
default: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
Expand All @@ -29,7 +33,14 @@ runs:
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Merge ${{ inputs.from }} with ${{ inputs.strategy }} strategy
shell: bash
run: git merge ${{ inputs.from }} -s ${{ inputs.strategy }} --no-ff
run: |
MERGE="git merge ${{ inputs.from }} -s ${{ inputs.strategy }}"
if [ "${{ inputs.commit }}" == "true" ]
then
eval $MERGE --commit
else
eval $MERGE --no-commit
fi
- name: "Push changes from ${{ inputs.from }} to origin"
shell: bash
run: |
Expand Down

0 comments on commit 701d2a3

Please sign in to comment.