add option to use --signoff with git commit (#46)

* adds option to use --signoff with git commit

Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>

* [auto] build: update compiled version

* fix: remove quotes and refactor

* [auto] build: update compiled version

Co-authored-by: Federico Grandi <fgrandi30@gmail.com>
This commit is contained in:
pvogt09
2020-07-29 19:04:48 +02:00
committed by GitHub
parent 46b61e173e
commit 51fc21c221
4 changed files with 20 additions and 2 deletions

View File

@@ -35,6 +35,10 @@ Add a step like this to your workflow:
# Default: false # Default: false
force: true force: true
# Whether to use the --signoff option on `git commit`
# Default: false
signoff: true
# The message for the commit # The message for the commit
# Default: 'Commit from GitHub Actions' # Default: 'Commit from GitHub Actions'
message: 'Your commit message' message: 'Your commit message'

View File

@@ -20,6 +20,10 @@ inputs:
description: Whether to use the force option on git add, in order to bypass eventual gitignores description: Whether to use the force option on git add, in order to bypass eventual gitignores
required: false required: false
default: "false" default: "false"
signoff:
description: Whether to use the signoff option on git commit
required: false
default: "false"
message: message:
description: The message for the commit description: The message for the commit
required: false required: false

View File

@@ -31,6 +31,11 @@ remove() {
if [ -n "$INPUT_REMOVE" ]; then git rm $INPUT_REMOVE; fi if [ -n "$INPUT_REMOVE" ]; then git rm $INPUT_REMOVE; fi
} }
commit() {
if $INPUT_SIGNOFF; then signoffcmd=--signoff; else signoffcmd=; fi
git commit -m "$INPUT_MESSAGE" --author="$INPUT_AUTHOR_NAME <$INPUT_AUTHOR_EMAIL>" $signoffcmd
}
tag() { tag() {
if [ -n "$INPUT_TAG" ]; then git tag $INPUT_TAG; fi if [ -n "$INPUT_TAG" ]; then git tag $INPUT_TAG; fi
} }
@@ -70,7 +75,7 @@ if ! git diff --cached --quiet --exit-code; then
remove remove
echo "Creating commit..." echo "Creating commit..."
git commit -m "$INPUT_MESSAGE" --author="$INPUT_AUTHOR_NAME <$INPUT_AUTHOR_EMAIL>" commit
echo "Tagging commit..." echo "Tagging commit..."
tag tag

View File

@@ -31,6 +31,11 @@ remove() {
if [ -n "$INPUT_REMOVE" ]; then git rm $INPUT_REMOVE; fi if [ -n "$INPUT_REMOVE" ]; then git rm $INPUT_REMOVE; fi
} }
commit() {
if $INPUT_SIGNOFF; then signoffcmd=--signoff; else signoffcmd=; fi
git commit -m "$INPUT_MESSAGE" --author="$INPUT_AUTHOR_NAME <$INPUT_AUTHOR_EMAIL>" $signoffcmd
}
tag() { tag() {
if [ -n "$INPUT_TAG" ]; then git tag $INPUT_TAG; fi if [ -n "$INPUT_TAG" ]; then git tag $INPUT_TAG; fi
} }
@@ -70,7 +75,7 @@ if ! git diff --cached --quiet --exit-code; then
remove remove
echo "Creating commit..." echo "Creating commit..."
git commit -m "$INPUT_MESSAGE" --author="$INPUT_AUTHOR_NAME <$INPUT_AUTHOR_EMAIL>" commit
echo "Tagging commit..." echo "Tagging commit..."
tag tag