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

Support documentation files outside of working-dir path #108

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ jobs:
| 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 | `README.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 |
| output-method | Method should be one of `replace`, `inject`, or `print` | `inject` | false |
| output-method | Method should be one of `replace`, `inject`, or `print`. Set as an empty string if `output.mode` and `output.file` are defined in config-file | `inject` | false |
| recursive | If true it will update submodules recursively | `false` | false |
| recursive-path | Submodules path to recursively update | `modules` | false |
| template | When provided will be used as the template if/when the `output-file` does not exist | `<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->` | false |
| template | When provided will be used as the template if/when the `output-file` does not exist. Set as an empty string if `output.template` is defined in config-file | `<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->` | false |
| working-dir | Comma separated list of directories to generate docs for (ignored if `atlantis-file` or `find-dir` is set) | `.` | false |

#### Output Method (output-method)
Expand Down
6 changes: 4 additions & 2 deletions src/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ update_doc() {
fi

if [ "${INPUT_OUTPUT_METHOD}" == "inject" ] || [ "${INPUT_OUTPUT_METHOD}" == "replace" ]; then
git_add "${working_dir}/${OUTPUT_FILE}"
for modified_files in $(git ls-files -m | grep -i "$(echo "${INPUT_OUTPUT_FILE}" | cut -d'/' -f2- )"); do
git_add "${modified_files}"
done
fi
}

Expand Down Expand Up @@ -177,7 +179,7 @@ fi
set +e
num_changed=$(git_status)
set -e
echo "num_changed=${num_changed}" >> $GITHUB_OUTPUT
echo "num_changed=${num_changed}" >> "$GITHUB_OUTPUT"

if [ "${INPUT_GIT_PUSH}" = "true" ]; then
git_commit
Expand Down