terraform-docs / gh-actions

A Github action for generating Terraform module documentation using terraform-docs and gomplate
Apache License 2.0
144 stars 61 forks source link

Default configurations lead to error #106

Closed tomer-ds closed 1 year ago

tomer-ds commented 1 year ago

Describe the bug

Using mainly default configurations the step fails with internal error. I originally started with more configurations but most of them were the defaults values anyway so I removed the explicit defaults

Workflow log

Run terraform-docs/gh-actions@v1.0.0
  with:
    output-format: markdown-table
    recursive: true
    git-push: true
    git-commit-message: [skip ci] terraform-docs: Update READMEs
    config-file: disabled
    working-dir: .
    atlantis-file: disabled
    find-dir: disabled
    recursive-path: modules
    output-method: inject
    output-file: README.md
    template: <!-- BEGIN_TF_DOCS -->
  {{ .Content }}
  <!-- END_TF_DOCS -->
    indention: 2
    git-push-sign-off: false
    fail-on-diff: false
  env:
    checkout_ref: feature/fresh-gke-playground

/usr/bin/docker run --name quayioterraformdocsghactions100_0a0729 --label a5c76b --workdir /github/workspace --rm -e "checkout_ref" -e "INPUT_OUTPUT-FORMAT" -e "INPUT_RECURSIVE" -e "INPUT_GIT-PUSH" -e "INPUT_GIT-COMMIT-MESSAGE" -e "INPUT_CONFIG-FILE" -e "INPUT_WORKING-DIR" -e "INPUT_ATLANTIS-FILE" -e "INPUT_FIND-DIR" -e "INPUT_RECURSIVE-PATH" -e "INPUT_OUTPUT-METHOD" -e "INPUT_OUTPUT-FILE" -e "INPUT_TEMPLATE" -e "INPUT_ARGS" -e "INPUT_INDENTION" -e "INPUT_GIT-PUSH-USER-NAME" -e "INPUT_GIT-PUSH-USER-EMAIL" -e "INPUT_GIT-PUSH-SIGN-OFF" -e "INPUT_FAIL-ON-DIFF" -e "INPUT_WORKING_DIR" -e "INPUT_ATLANTIS_FILE" -e "INPUT_FIND_DIR" -e "INPUT_RECURSIVE_PATH" -e "INPUT_OUTPUT_FORMAT" -e "INPUT_OUTPUT_METHOD" -e "INPUT_OUTPUT_FILE" -e "INPUT_GIT_PUSH" -e "INPUT_GIT_COMMIT_MESSAGE" -e "INPUT_CONFIG_FILE" -e "INPUT_FAIL_ON_DIFF" -e "INPUT_GIT_PUSH_SIGN_OFF" -e "INPUT_GIT_PUSH_USER_NAME" -e "INPUT_GIT_PUSH_USER_EMAIL" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_DEBUG" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/om2-terraform-gke/om2-terraform-gke":"/github/workspace" quay.io/terraform-docs/gh-actions:1.0.0
From https://github.com/jivygroup/om2-terraform-gke
 * [new tag]         0.1.0      -> 0.1.0
 * [new tag]         0.2.0      -> 0.2.0
 * [new tag]         0.3.0      -> 0.3.0
::debug working_dir=.
::debug output_mode=inject
::debug output_file=README.md
::debug terraform-docs markdown-table --output-mode inject --output-file README.md --output-template <!-- BEGIN_TF_DOCS -->
{{ .Content }}
<!-- END_TF_DOCS --> --recursive --recursive-path modules .
Error: accepts at most 1 arg(s), received 2

How can we reproduce it?

Add step to GitHub actions and run the workflow

  docs:
    runs-on: ubuntu-latest
    steps:
      - run: |
          echo "No pull request found, using ref"
          echo checkout_ref="${{ github.ref }}" >> $GITHUB_ENV

      - if: contains(github.ref, 'pull')
        run: |
          echo "Pull request found, using head ref"
          echo checkout_ref="${{ github.head_ref }}" >> $GITHUB_ENV

      - uses: actions/checkout@v3
        with:
          ref: ${{ env.checkout_ref }}

      - name: Render terraform docs inside the README.md and push changes back to PR branch
        uses: terraform-docs/gh-actions@v1.0.0
        with:
          output-format: markdown-table
          recursive: "true"
          git-push: "true"
          git-commit-message: "[skip ci] terraform-docs: Update READMEs"

Environment information

tomer-ds commented 1 year ago

I honestly cannot recall from which documtation I got the value markdown-table from for use in the output-format input argument. I know I saw it somewhere but for the life of me no longer... 🤷🏼

Anyway it seems that removing the specification and falling back on the default worked, and since the default is what I wanted it seems all is good...