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

ERROR: Action failed during execution #103

Closed
laureanorp opened this issue Oct 28, 2021 · 6 comments
Closed

ERROR: Action failed during execution #103

laureanorp opened this issue Oct 28, 2021 · 6 comments

Comments

@laureanorp
Copy link

laureanorp commented Oct 28, 2021

Hello! So, I'm trying this action with the default settings:

image

Flake8 doesn't have any problems to detect all the errors in the project, but in the end, after printing all the flake8 errors, this error appears:

ERROR: Action failed during execution with error: The process '/opt/hostedtoolcache/Python/3.8.12/x64/bin/flake8' failed with exit code 1

image

I wouldn't have a problem if I only wanted to use that one step. But I wan't to add a few more steps on this action, more flake8 checks on other folders, and since the first one fails, the next one won't start.

Is it normal that the action throws that error? @chrissimpkins

@chrissimpkins
Copy link
Contributor

chrissimpkins commented Oct 28, 2021

Hi Laureano!

Yes, this is intentional behavior. flake8 emits a non-zero exit status code when it finds any error/fail level issue in your source files. Most people will want this approach because it causes the CI tests to fail and, in turn, on GitHub your GH Actions test list on PR threads will flag with a big red X. If you don't get the non-zero exit status code, this is considered a CI "pass".

You can disable this behavior in flake8 with the --exit-zero option. This will force it to "pass" with a zero exit status code no matter what it finds. Then you just review the log and decide if anything is relevant in the lint.

See the py-actions/flake8 args configuration example in our own CI tests of the flake8 CI tester [meta] :) ==>

args: "--quiet"

If you toss --exit-zero into that field of your GH Action configuration file, the message should go away.

Hope this helps!

@chrissimpkins
Copy link
Contributor

I think that GH Actions supports a config that will run all tests even if there is a CI fail. This would work around the issue without any modifications if you are ok with having the failing lints. You'll need to refer to the Actions docs for that one. I don't know off the top of my head.

@chrissimpkins
Copy link
Contributor

I will admit that it is misleading that your output shows a big red "ERROR" string though. Let me look into that.

@chrissimpkins
Copy link
Contributor

I will admit that it is misleading that your output shows a big red "ERROR" string though. Let me look into that.

#104

@laureanorp
Copy link
Author

laureanorp commented Oct 29, 2021

Thank you so much for the explanation! I added continue-on-error: true to all my steps and in the end I check the outcome, if any of them failed, I return an error for the action. I won't use args: --exit-zero because then the outcomes are always success, tho. From my side, you can close this issue.

@chrissimpkins
Copy link
Contributor

Thank you so much for the explanation! I added continue-on-error: true to all my steps and in the end I check the outcome, if any of them failed, I return an error for the action. I won't use args: --exit-zero because then the outcomes are always success, tho. From my side, you can close this issue.

Glad to hear that it helped!

I am fixing the error string in #105. This will change the output so that it does not indicate that flake8 exited with an error. This is not semantically correct in all cases. The non-zero exit status code most commonly means that it identified an issue in the lints. Thank you very much for raising the issue and improving the software!

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

No branches or pull requests

2 participants