Increase code quality with Github Actions

Stanley Gomes
The Startup
Published in
2 min readJun 20, 2020
Github Actions

We are always writing, every day, tons of lines of code. We add new features and change existing ones. We fix bugs and, sometimes, we may create some bugs too.

You can avoid basic bugs by creating some automatic routines such as lint and test your app every push or pull request.

Let me show you a simple example of a bug easily catch by a lint workflow.

You have to implement a new feature on your app that changes a function calculation using parameters.

Take a look at this code below.

In this example above, someone forgot to take a look at all places where that function is called, causing side effects.

Now, let’s go to check out an Github Workflow file to execute a npm lint and test before our feature actually goes to master and production environment.

Now take a look at a sample of workflow that failed and pull request is now bloqued until the details are fixed.

Hope this helps you to implement some automatic validations. These types of tips are essential to solve some points that go unnoticed by us developers.

Let me know if there is anything I can help you with. See you soon!

--

--