Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'git-push-sign-off' input parameter #17

Merged
merged 1 commit into from
Jan 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 7 additions & 1 deletion src/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Copy link

@aitorbalbas aitorbalbas Mar 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This -s should not be -S in uppercase?
lowercase s means silent not signed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it should be -s, --signoff. There's no -S in git, AFAIR, and for that matter there's no silent mode, rather --quiet mode.

fi
git commit ${signoff} -m "${GIT_COMMIT_MESSAGE}"
fi
}

Expand Down