diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b3d5037..26a87a2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,7 @@ name: ci on: + workflow_dispatch: pull_request: jobs: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 24c9436..ce9d8e3 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,9 +1,15 @@ name: publish on: + workflow_dispatch: push: branches: - main + paths: + - .github/workflows/publish.yml + - Dockerfile + - action.yml + - src/docker-entrypoint.sh env: REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 00d5934..8bc9f1b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,7 @@ name: validate on: + workflow_dispatch: push: branches: - main @@ -33,8 +34,22 @@ jobs: sudo chmod 755 /usr/local/bin/gomplate - name: Check README content based on action.yml + if: ${{ github.repository_owner == 'terraform-docs' }} run: | ./scripts/update-readme.sh if [ $(git status --porcelain | grep -c 'M README.md') -eq 1 ]; then + git diff exit 1 fi + + - name: Check README content based on action.yml + if: ${{ github.repository_owner != 'terraform-docs' }} + run: | + ./scripts/update-readme.sh + if [ $(git status --porcelain | grep -c 'M README.md') -eq 1 ]; then + git config user.email "noreply.${{ github.actor }}@github.com" + git config user.name "${{ github.actor }}" + git add README.md + git commit -s -m "docs: README.md Updated" + git push + fi diff --git a/README.md b/README.md index bbe3fe3..a592f0a 100644 --- a/README.md +++ b/README.md @@ -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 | `\n{{ .Content }}\n` | 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 | `\n{{ .Content }}\n` | 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) diff --git a/src/docker-entrypoint.sh b/src/docker-entrypoint.sh index b90445b..d9a61a0 100755 --- a/src/docker-entrypoint.sh +++ b/src/docker-entrypoint.sh @@ -177,7 +177,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