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:
@@ -35,6 +35,10 @@ Add a step like this to your workflow:
|
||||
# Default: false
|
||||
force: true
|
||||
|
||||
# Whether to use the --signoff option on `git commit`
|
||||
# Default: false
|
||||
signoff: true
|
||||
|
||||
# The message for the commit
|
||||
# Default: 'Commit from GitHub Actions'
|
||||
message: 'Your commit message'
|
||||
|
||||
@@ -20,6 +20,10 @@ inputs:
|
||||
description: Whether to use the force option on git add, in order to bypass eventual gitignores
|
||||
required: false
|
||||
default: "false"
|
||||
signoff:
|
||||
description: Whether to use the signoff option on git commit
|
||||
required: false
|
||||
default: "false"
|
||||
message:
|
||||
description: The message for the commit
|
||||
required: false
|
||||
|
||||
@@ -31,6 +31,11 @@ remove() {
|
||||
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() {
|
||||
if [ -n "$INPUT_TAG" ]; then git tag $INPUT_TAG; fi
|
||||
}
|
||||
@@ -70,7 +75,7 @@ if ! git diff --cached --quiet --exit-code; then
|
||||
remove
|
||||
|
||||
echo "Creating commit..."
|
||||
git commit -m "$INPUT_MESSAGE" --author="$INPUT_AUTHOR_NAME <$INPUT_AUTHOR_EMAIL>"
|
||||
commit
|
||||
|
||||
echo "Tagging commit..."
|
||||
tag
|
||||
|
||||
@@ -31,6 +31,11 @@ remove() {
|
||||
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() {
|
||||
if [ -n "$INPUT_TAG" ]; then git tag $INPUT_TAG; fi
|
||||
}
|
||||
@@ -70,7 +75,7 @@ if ! git diff --cached --quiet --exit-code; then
|
||||
remove
|
||||
|
||||
echo "Creating commit..."
|
||||
git commit -m "$INPUT_MESSAGE" --author="$INPUT_AUTHOR_NAME <$INPUT_AUTHOR_EMAIL>"
|
||||
commit
|
||||
|
||||
echo "Tagging commit..."
|
||||
tag
|
||||
|
||||
Reference in New Issue
Block a user