-
-
Notifications
You must be signed in to change notification settings - Fork 235
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
Default mega-linter.yml
workflow generated gets tripped up with ActionLinter
#3025
Comments
One other finding - it looks like Prettier doesn't play nicely with GitHub action linting at times. It will update what I wrote above to use double-quotes, which in turn creates an error with the other linter. A quick and dirty way to get around this is to drop usage of the curly-brackets: if: success() || failure() They are not required for |
I do believe this is an incorrect lint, btw, per: |
Would u like to make a PR ? :) |
I'm curious to see if it really works! At the time, it used to be that a if failure() was needed in order to not be skipped when any step failed. Since cancelled() is a status check function, the note in https://docs.github.com/en/actions/learn-github-actions/expressions#failure-with-conditions might mean that it should work ;) |
I was able to use |
I tried this, but Prettier insisted on changing this to double quotes with if: success() || failure() Which seems to be the recommendation, now, to not use curly-brackets in |
A mix of linters fail here, starting with actionlint throwing an (incorrect) "... is always evaluated to true because extra characters are around ${{ }}". I believe this is accidentally assuming the entire statement is curly-bracket wrapped, which it isn't. Regardless, curly brackets are not required for `if` statements in the YAML, and can be removed. A best-practice approach would be changing this to the newer '!cancelled()' flag, which does the same thing, but this will throw errors when Prettier ultimately changes the single-quotes to double-quotes and breaks the statement. As such, the best course of action is to simply remove the curly- brackets from the existing statement to satisfy Checkov and prevent linting errors in the default-generated file.
* Fix: Removed curly-brackets from if (closes #3025) A mix of linters fail here, starting with actionlint throwing an (incorrect) "... is always evaluated to true because extra characters are around ${{ }}". I believe this is accidentally assuming the entire statement is curly-bracket wrapped, which it isn't. Regardless, curly brackets are not required for `if` statements in the YAML, and can be removed. A best-practice approach would be changing this to the newer '!cancelled()' flag, which does the same thing, but this will throw errors when Prettier ultimately changes the single-quotes to double-quotes and breaks the statement. As such, the best course of action is to simply remove the curly- brackets from the existing statement to satisfy Checkov and prevent linting errors in the default-generated file. * Added changelog entry --------- Co-authored-by: Edouard Choinière <[email protected]>
Describe the bug
To Reproduce
Steps to reproduce the behavior:
A clearer way to have this functionality work would be to change the line to:
This makes it clear that the Artifacts should only upload if any action was taken except cancellation. Note that the quotes are necessary so that
!
isn't flagged as a YAML tag.The text was updated successfully, but these errors were encountered: