diff --git a/action.yml b/action.yml index f50fe17..e926c4f 100644 --- a/action.yml +++ b/action.yml @@ -10,23 +10,23 @@ inputs: author: description: 'Commit author' required: false - default: '${GITHUB_ACTOR}' + default: '"${GITHUB_ACTOR}"' email: description: 'Committer email' required: false - default: '${GITHUB_ACTOR_ID}+${GITHUB_ACTOR}@users.noreply.github.com' + default: '"${GITHUB_ACTOR_ID}+${GITHUB_ACTOR}@users.noreply.github.com"' rebase: description: 'Pull rebase config' required: false - default: true + default: false fast-forward: description: 'Pull fast-forward config' required: false - default: false + default: true branch: description: 'Git branch' required: false - default: '${GITHUB_REF_NAME}' + default: '"${GITHUB_REF_NAME}"' files: description: 'Files to push' required: false @@ -40,16 +40,16 @@ runs: steps: - name: 'Configure the runner' run: | - git config --global user.name ${{ inputs.author }} - git config --global user.email ${{ inputs.email }} + git config user.name ${{ inputs.author }} + git config user.email ${{ inputs.email }} shell: bash - name: 'Set rebase pull mode' - if: ${{ !inputs.fast-forward && inputs.rebase }} + if: ${{ inputs.rebase }} run: | git config pull.rebase true shell: bash - name: 'Set fast-forward pull mode' - if: ${{ inputs.fast-forward }} + if: ${{ !inputs.rebase && inputs.fast-forward }} run: | git config pull.ff true shell: bash diff --git a/setup-branch.sh b/setup-branch.sh index 86c20fc..d58cf01 100755 --- a/setup-branch.sh +++ b/setup-branch.sh @@ -1,14 +1,18 @@ #!/bin/sh git fetch --all --quiet +git stage -A . +stash_ref="$(git stash create)" +work_branch=$(git symbolic-ref --short HEAD) if git rev-parse --quiet --verify "origin/$1" >/dev/null then - git stash --include-untracked - stash_ref=$(git stash create) - work_branch=$(git symbolic-ref --short HEAD) git switch $1 - git merge --squash --strategy-option=theirs --allow-unrelated-histories $work_branch - git stash apply "$stash_ref" - git reset HEAD -- . else git switch --orphan $1 + git commit --allow-empty -m "Initialize branch" fi +git merge --squash --strategy-option=theirs --allow-unrelated-histories $work_branch +if [ -n "$stash_ref" ] +then + git stash apply $stash_ref +fi +git reset HEAD -- .