devops-infra/action-format-hcl

check input error.

Closed this issue · 9 comments

I've set up the linter with the following settings:

- name: Fail on malformatted files
        uses: devops-infra/action-format-hcl@v0.3.2
        with:
          check: true
          write: false

I am getting the error attached in the screenshot.
Despite I set up 'write:false'. Looks like it's ignoring it, then I get the error:

=> Searching for .hcl files
Error, -check and -write=true cannot be used together

check_error

Hello, thank you for using my action!

I'll have a look at it.
Maybe already I'll replace using those scripts with simply using Terragrunt, as it finally can format all .hcl and .tf files.

I've released v0.3.5 which should resolve the problem.
image

I also checked terragrunt hclfmt, but it just fixes the files without any options that terraform fmt has. But it's much faster, so maybe I'll consider it in the future as an option if somebody has a lot of files.

Thanks @ChristophShyper for your prompt response and action. I have a question:
I need it fails in case it find an error in the linting process. I thought using check input it fails but not.
Do you know how can achieve that goal?
See screenshot
error_no_fail

Hello @jevalenciap .
You're right I recently removed set -e from the dependent script it stopped failing on the first type of files.
But now I fixed it in origin and released v0.3.6 version where it's fixed, as I just tested.

Thank you so much! It's working fine now

Hello @ChristophShyper,

Sorry, but now the github action is always failing despite there are not linting errors:

failing_linter

I think it needs to fail once a linting error is found but not when there are not errors found.

May you please apply a fix?

Thanks in advance!

hi @jevalenciap I've tested it on all 4 possible scenarios and all work well for me.
Are you sure all your files are formatted properly?

Thanks @ChristophShyper, I don't know why it was failing but after removing a couple of files that were not longer needed, it's working fine.
Apologies for the inconveniences.

@jevalenciap No need to apologize. Thanks to you, I noticed an error in the script being used here.