Quick Note: Allow Failures on Github Actions

TL;DR

command || true
# true will return exit-code 0 no matter what

The Story

I was in the process of developing a new library for Django and thought maybe it is now a good time to try out new Github Actions. I was hesitating a bit but I've set up things and it is actually pretty good. Github Actions is a lot faster. I was using TravisCI but the remote machines of Github Actions service spawn quicker and finish faster. What's more it is integrated right into Github.

To the point, I've built up my matrix from Python 3.5 through 3.7. However, black only supports from 3.6. So Python 3.5 tests naturally fail on pip installation. That's why I've looked up how to get pip running even if it fails on one package and I've found one. While pip does not have a built-in solution to this, I have found this hack to be quite useful. Basically, bash reads requirements.txt one by one and redirects lines to pip install. I thought that's enough and spawned the CI.

It looked like it was going good at the beginning. The installation step finished, yet it rendered as failure. Yes, there was failures here and there (on black, mainly) but it ended. Then I thought maybe Github Actions considers it as failing if any pip install fails.

There was one way to do this and it was to allow failures in installation step. I've looked up for it but Github Actions did not have that. It is not surprising since Github Actions is a relatively new service. Then, I finally resolved my problem by appending true with "or" (double pipes).

command || true

You know how logic works. If one returns true, exit-code is true. true here always return exit-code 0, so that solves the problem. I hope the internet is a calmer place now.

No Comments Yet