diff --git a/README.md b/README.md index 50faf6c..55324bf 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ jobs: | find-dir | Name of root directory to extract list of directories by running `find ./find\_dir -name \*.tf` (ignored if `atlantis-file` is set) | `disabled` | false | | git-commit-message | Commit message | `terraform-docs: automated action` | false | | git-push | If true it will commit and push the changes | `false` | false | +| git-push-sign-off | If true it will sign-off commit | `false` | false | | indention | Indention level of Markdown sections [1, 2, 3, 4, 5] | `2` | false | | output-file | File in module directory where the docs should be placed | `USAGE.md` | false | | output-format | terraform-docs format to generate content (see [all formats](https://github.com/terraform-docs/terraform-docs/blob/master/docs/FORMATS\_GUIDE.md)) (ignored if `config-file` is set) | `markdown table` | false | diff --git a/action.yml b/action.yml index cd89e4b..af46fa7 100644 --- a/action.yml +++ b/action.yml @@ -55,6 +55,10 @@ inputs: description: Commit message required: false default: "terraform-docs: automated action" + git-push-sign-off: + description: If true it will sign-off commit + required: false + default: "false" fail-on-diff: description: Fail the job if there is any diff found between the generated output and existing file (ignored if `git-push` is set) required: false @@ -81,6 +85,7 @@ runs: - ${{ inputs.git-commit-message }} - ${{ inputs.config-file }} - ${{ inputs.fail-on-diff }} + - ${{ inputs.git-push-sign-off }} branding: icon: file-text diff --git a/src/docker-entrypoint.sh b/src/docker-entrypoint.sh index 950a3ac..6e79199 100755 --- a/src/docker-entrypoint.sh +++ b/src/docker-entrypoint.sh @@ -16,6 +16,7 @@ GIT_PUSH="${10}" GIT_COMMIT_MESSAGE="${11}" CONFIG_FILE="${12}" FAIL_ON_DIFF="${13}" +GIT_PUSH_SIGN_OFF="${13}" if [ "${CONFIG_FILE}" == "disabled" ]; then case "$OUTPUT_FORMAT" in @@ -63,7 +64,12 @@ git_commit() { echo "::debug file=entrypoint.sh,line=54 No files changed, skipping commit" exit 0 else - git commit -m "${GIT_COMMIT_MESSAGE}" + local signoff + signoff="" + if [ "${GIT_PUSH_SIGN_OFF}" = "true" ]; then + signoff="-s" + fi + git commit ${signoff} -m "${GIT_COMMIT_MESSAGE}" fi }