diff --git a/action.yml b/action.yml index eb3d1cd..fd82666 100644 --- a/action.yml +++ b/action.yml @@ -4,6 +4,11 @@ maintainer: Cirrus Labs runs: using: 'docker' image: 'Dockerfile' +inputs: + autosquash: + description: Should the rebase autosquash fixup and squash commits + required: false + default: false branding: icon: git-pull-request color: purple \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh index f80d05c..e776c9d 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -100,7 +100,11 @@ git fetch fork $HEAD_BRANCH # do the rebase git checkout -b fork/$HEAD_BRANCH fork/$HEAD_BRANCH -git rebase origin/$BASE_BRANCH +if [[ $INPUT_AUTOSQUASH -eq 'true' ]]; then + GIT_SEQUENCE_EDITOR=: git rebase -i --autosquash origin/$BASE_BRANCH +else + git rebase origin/$BASE_BRANCH +fi # push back git push --force-with-lease fork fork/$HEAD_BRANCH:$HEAD_BRANCH