How to improve the efficiency of git commits in a remote team ?
Tags: javascript, git, github, actions
Published: 2022-03-03 18:34:19

## Why this article

As we dive further into 2022, I thought it was a good time to make a recap of 2021 in terms of tools and technologies that I've put in place as a CTO in a growing (startup) agency. 

Covid-19 has, for sure, been a rough time. People had to re-think their infrastructures, how they work, how they communicate and more basically, how they interact and stay organized while being in quarantine. But because of that, it brought new challenges and thus, new opportunities to startup like ours.

## Communication is the key

When it comes to organization in a team, most of the time, problems come from a lack of (efficient) communication. 
For example, when managing multiple projects at once or working with developers around the world using different technology stacks, you are required to be as thorough as possible in order to keep track of what have been/need to be done. Here starts the problem, even though you can be extremely organized (I've, myself, been using dozen of apps for this kind of purpose, I'll publish an article later on my thoughts & findings), **if only one link in the chain lacks rigor, the entire organization is compromised** !

## My take on 'cutting the man in the middle'

As logical as it is, when you need to rely on someone else, you become dependent on his skills and organizational system, thus, if he misses to keep in touch with you about his latest achievements (egc: push on a git repo to fix a bug, new feature, pull request...), there is an impact on the time it takes to accomplish common actions (code review, merging features).

![schema representing what a feature integration](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t9a21jj691ba0yd74u87.png)
> Here is a schema representing what a feature integration looks like with the given problematic

When I understood that I could not control how other human being manage their time and organization, I asked myself 'What can I do to fix this ?', the answer was pretty obvious, I needed to create kind of a bot, acting as an intermediary between me and the developers.
**Well, as you can see, it's not so much about cutting the man in the middle but replacing the man by the bot !**

![Here is a schema with optimized workflow](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ceyk1zf8cyn7d88p2xia.png)
> Here is the schema representing the optimized workflow using the bot I created as a replacement for the human (report) interaction 

## Creating the perfect assistant

The following list contains (mostly) all the informations I'm looking for when one of our developers make a commit:
  - User making the commit
  - Commit date (localized) 
  - Get a clear report on what have been done.
  - Which type of modifications we are looking at (feature integration, bug fix...).
  - Which files have been edited.
  - Number of modifications, number of changes (additions/deletions)

## Github action workflow

With these informations, I can do the technical review efficiently, mainly because I know what I'm looking at and what I need to pay attention to.
Based on these criteria, I started building my Github action and this is the workflow I've come to:
  - A developer makes a commit to one of our repos, triggering the Github action.
  - The action processes the infos extracted from the commit
  - It then generates a comment on the given commit with the following infos: 

![Github action example commit's comment](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/84ubs3bj7jqz8785ihgf.png)

  - At the same time, it triggers an event for sending an email to the repositories' designated maintainers that looks like that: 

![Mail received from the Github action on new commit](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b7slv718jt9euexxh28x.jpeg)

**As you can see, with this process, we receive live the infos we need from the developers without the need of a human report.**

## Conclusion

Not only did it halve the time needed for technical code review, but it completely eliminated the need to ask developers to "Don't forget to send your report". 
You are pleased to use it in your projects, I'm sure that it will help you or your team to be more productive hence having the time for the things that matter the most.
For all configuration options and parameters available for the Github action, you are welcome to take a look at the repository (link below).
Hope you enjoy ! 
Leave a star on the repo if you find it helpful (and drop a comment on this article to tell me what you think about it)
See you next time !

## The repository: Git-Push-metadata-action
{% embed https://github.com/ZeitounCorp/Git-Push-metadata-action %}

### A little bit more about me:

I'm Lenny, (ex) software engineer, now CTO in a growing startup (called [Tsohar](https://www.linkedin.com/company/tsohar-agency/)) focused on Consulting for helping people to develop and grow their ideas into a reliable, rewarding and profitable business. 
Here are some links to my networks:
- [GitHub](https://github.com/ZeitounCorp)
- [Linkedin](https://www.linkedin.com/in/lenny-zeitoun/)
- [Dev.to](https://dev.to/zeitouncorp)