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

check input error. #73

Closed
jevalenciap opened this issue Jan 30, 2023 · 9 comments · Fixed by #78
Closed

check input error. #73

jevalenciap opened this issue Jan 30, 2023 · 9 comments · Fixed by #78
Assignees

Comments

@jevalenciap
Copy link

jevalenciap commented Jan 30, 2023

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

@ChristophShyper
Copy link
Member

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.

ChristophShyper added a commit that referenced this issue Jan 31, 2023
Fix file compare.
Remove not used git install.
Bump release to v0.3.4.

Addresses #73
@ChristophShyper
Copy link
Member

ChristophShyper commented Jan 31, 2023

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.

@ChristophShyper ChristophShyper self-assigned this Jan 31, 2023
@jevalenciap
Copy link
Author

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

ChristophShyper added a commit that referenced this issue Feb 1, 2023
Bump Ubuntu to jammy-20230126.

Bump release to v0.3.6.

Fixes #73
@ChristophShyper
Copy link
Member

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.

@jevalenciap
Copy link
Author

Thank you so much! It's working fine now

@jevalenciap
Copy link
Author

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!

@ChristophShyper
Copy link
Member

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?

@jevalenciap
Copy link
Author

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.

@ChristophShyper
Copy link
Member

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

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

Successfully merging a pull request may close this issue.

2 participants