Skip to content

Error: Uncommitted change(s) has been found! #124

Open
@arivictor

Description

@arivictor

Describe the bug

I am trying to do a fail-on-diff check for a terraform module doc on a pull request. The GHA fails with

 * [new tag]         1.0.0      -> 1.0.0
 * [new tag]         1.1.0      -> 1.1.0
::debug working_dir=.
::debug config_file=.terraform-docs.yml
::debug output_mode=replace
::debug output_file=README.md
::debug terraform-docs markdown table --config .terraform-docs.yml --output-mode replace --output-file README.md --output-template <!-- BEGIN_TF_DOCS -->
{{ .Content }}
<!-- END_TF_DOCS --> .
README.md updated successfully
::debug No change in ./ detected

Error: Uncommitted change(s) has been found!

There is no change between my current README.md and the generated one (well, there shouldn't be in theory).

How can we reproduce it?

workflow

name: 'terraform docs'

on:
  pull_request:

permissions:
  contents: read

jobs:
  docs:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
      with:
        ref: ${{ github.event.pull_request.head.ref }}

    - name: Generate TF Docs
      uses: terraform-docs/[email protected]
      with:
        config-file: .terraform-docs.yml
        working-dir: .
        output-file: README.md
        output-method: replace
        fail-on-diff: true

config

formatter: markdown table
header-from: main.tf
footer-from: ""
sections:
  show:
    - all
output:
  file: README.md
  mode: replace
  template: |-
    <!-- BEGIN_TF_DOCS -->
    
    {{ .Content }}

    <!-- END_TF_DOCS -->

sort:
  enabled: true
  by: required

settings:
  anchor: true
  indent: 2
  escape: false
  default: true
  required: true
  type: true

Environment information

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions