Skip to content

Commit

Permalink
commit: add AMEND and FORCE options
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Apr 29, 2020
1 parent 23a006a commit ce88bb2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
16 changes: 13 additions & 3 deletions commit/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ author: 'elstudio'
branding:
icon: 'git-commit'
color: 'green'
inputs:
inputs:
wdPath:
description: 'Working directory path'
required: false
Expand All @@ -13,14 +13,24 @@ inputs:
description: 'Print script debugging info'
required: false
default: 'false'
commitMessage:
commitMessage:
description: 'Message to log for this commit'
required: false
default: 'Regenerate build artifacts.'
amend:
description: '--amend the previous commit, instead of adding a new one'
required: false
default: false
force:
description: 'do a force push (only useful with `amend`'
required: false
default: false
runs:
using: 'docker'
image: 'Dockerfile'
env:
DEBUG: ${{ inputs.debug }}
WD_PATH: ${{ inputs.wdPath }}
COMMIT_MESSAGE: ${{ inputs.commitMessage }}
COMMIT_MESSAGE: ${{ inputs.commitMessage }}
AMEND: ${{ inputs.amend }}
FORCE: ${{ inputs.force }}
12 changes: 10 additions & 2 deletions commit/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,16 @@ if expr $(git status --porcelain | wc -l) \> 0
then
git_setup
git add .
git commit -m "$COMMIT_MESSAGE"
git push
if [ "${AMEND-}" = true ]; then
git commit --amend --no-edit
else
git commit -m "$COMMIT_MESSAGE"
fi
if [ "${FORCE-}" = true ]; then
git push --force-with-lease
else
git push
fi
else
echo "Working tree clean. Nothing to commit."
fi

0 comments on commit ce88bb2

Please sign in to comment.