Skip to content

Commit

Permalink
feat(rebase): add force option
Browse files Browse the repository at this point in the history
  • Loading branch information
EdieLemoine committed Jul 21, 2022
1 parent 4e10ec1 commit a0fc4e4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,14 @@ Set up git credentials and authenticate as MyParcelBot.

Rebase two branches and push.

- Needs a [GitHub] token in `token`.
##### Inputs

| required | name | description | Example | Default |
|----------|----------|--------------------------------------|--------------------------------|---------|
| Yes | `target` | Target branch you wish to update. | `develop` ||
| Yes | `base` | Base branch to use to rebase target. | `main` ||
| Yes | `token` | GitHub token to use. | `${{ secrets.GH_REPO_TOKEN }}` ||
| No | `force` | Force push. | `true` | `false` |

##### Example

Expand All @@ -311,6 +318,7 @@ Rebase two branches and push.
token: ${{ secrets.GITHUB_TOKEN }}
base: main
target: develop
force: true
```

#### update-tags
Expand Down
13 changes: 11 additions & 2 deletions rebase/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ inputs:
description: 'GitHub token to use.'
required: true

force:
description: 'Force push.'
required: false
default: 'false'

runs:
using: composite
steps:
Expand All @@ -27,8 +32,12 @@ runs:
with:
token: ${{ inputs.token }}

- name: 'Rebase and push'
- name: 'Rebase'
shell: bash
run: |
git rebase "origin/${{ inputs.base }}"
git push
- name: 'Push'
shell: bash
run: |
git push ${{ inputs.force == 'true' && "--force" }}

0 comments on commit a0fc4e4

Please sign in to comment.