Skip to content

Commit

Permalink
feat: add strategy rebase
Browse files Browse the repository at this point in the history
Add strategy `rebase` that rebases the commits in the target branch onto the source branch.

Closes #1
  • Loading branch information
jojomatik committed Mar 10, 2022
1 parent 6067524 commit 80d5d3f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ jobs:
# Optional
# Default: `beta`
target: "v1"
# The strategy to use, if fast-forward is not possible (merge, force, fail).
# The strategy to use, if fast-forward is not possible (merge, rebase, force, fail).
# Optional
# Default: `merge`
# Possible values:
# - `merge`: merge the source branch into the target branch
# - `rebase`: rebase the target branch onto the source branch
# - `force`: force push the source branch to the target branch (overrides any changes on the target
# branch)
# - `fail`: pushes the source branch to the target branch, fails if the target branch contains changes
Expand Down
8 changes: 8 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ runs:
if: inputs.strategy == 'merge'
run: git push
shell: bash
- name: Rebase ${{ inputs.target }} onto ${{ inputs.source }}
if: inputs.strategy == 'rebase'
run: git rebase ${{ inputs.source }} ${{ inputs.target }}
shell: bash
- name: Force push ${{ inputs.target }}
if: inputs.strategy == 'rebase'
run: git push --force origin ${{ inputs.target }}
shell: bash
- name: Force push ${{ inputs.source }} to ${{ inputs.target }}
if: inputs.strategy == 'force'
run: git push --force origin ${{ inputs.source }}:${{ inputs.target }}
Expand Down

0 comments on commit 80d5d3f

Please sign in to comment.