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

TF Docs adds extra files on git_add when using working directory '.' #85

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Penson122
Copy link

@Penson122 Penson122 commented May 24, 2022

Description of your changes

When using TF Docs after other steps which contain lint actions for example which output additional files to the current working directory TF Docs will add those files. With the following configuration at the end of a workflow run I get additional files in my PRs. I believe this is because the OUTPUT_FILE variable is not defined. It appears it should be $INPUT_OUTPUT_FILE.

To replicate, create a job which touchs some files and then runs this step.

    - name: TF-Docs
      uses: terraform-docs/[email protected]
      with:
        working-dir: .
        output-file: README.md
        output-method: inject
        git-push: "true"

See example issue here:

Penson122/test-tf-docs@f67b1e8

I have:

How has this code been tested

See this PR targeting my fork branch test-fix. Of note I have had to make two additional changes on that branch to get a passing build. The first commit uses the local docker image. This is so that I'm actually testing my branch and not the 1.0.0 published version. And secondly I've also had to amend the src/entrypoint.sh to resolve a workspace permissions issue. I'm not sure if this is something that will also need to be done if this change is to be released. I'll leave that for the maintainers to test, or otherwise please provide instructions.

Penson122/test-tf-docs@18296f0

Also testing branch with additional commit to src/entrypoint.sh
https://github.com/Penson122/gh-actions/commits/test-fix

When using TF Docs after other steps which contain lint actions for example which output additional files to the current working directory TF Docs will add those files. With the following configuration at the end of a workflow run I get additional files in my PRs. I believe this is because the `OUTPUT_FILES` variable is not defined. It appears it should be $INPUT_OUTPUT_FILE.

To replicate, create a job which `touch`s some files and then runs this step.

```
    - name: TF-Docs
      uses: terraform-docs/[email protected]
      with:
        working-dir: .
        output-file: README.md
        output-method: inject
        git-push: "true"
```

Signed-off-by: Jack Penson <[email protected]>
@mohamed-haidara-cko
Copy link

Same issue for me as well. Is there any change to review and merge this?

@mohamed-haidara-cko
Copy link

Up (just in case the PR got forgotten) :-)

@chelsea-codes
Copy link

This would be a great fix to add. Is there anyone to review it? Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants