Using GitHub but want to use the powerful tool that is GitLab CI? Get the best of both world and use them together!

I love GitLab. I really do. As many other Git users, I started learning git with GitHub a few years ago, and I’ve kept using it since.

However, GitHub has not changed much in all these years, it’s evolving really slowly. On the other hand, GitLab changes every week and has so much features. When you start to dive into GitLab, you understand how far behind GitHub is.

I use a self-hosted instance of GitLab at work and we mainly use the CI for Terraform pipelines. I really like how GitLab CI is integrated into GitLab.

Nonetheless, I like GitHub too, especially its social aspect, which is very important for me. That’s why, even though they were acquired by Microsoft, I will still host my repositories on it for now.

What is really cool is that I can use them both, together, thanks to GitLab CI/CD for GitHub.

To setup GitLab CI from GitHub, you have to create a new project, and then under the “CI/CD for external repo” tab, click GitHub and then connect a repository.

This isn’t a half-assed feature: when you mirror a repo by going trough this step, GitLab disabled issues, merge requests, wiki, etc, in order to have a ~read-only mirror. It then adds a webhook on the GitHub repo to pull on GitLab when there is a push on GitHub.

Then, add a .gitlab-ci.yml to the repo, and voilà, the pipelines are running and integrated with GitHub!

CI/CD is very discrete on GitHub. That’s also one of the things I prefer on GitLab.

CI/CD is very discrete on GitHub. That’s also one of the things I prefer on GitLab.

While GitLab CI is a part of GitLab itself, the runners aren’t. I run mine for building my docker images (it’s really easy to setup), but the kind folks at GitLab.com provides free shared runners for open-source projects! They’re performing pretty well, so I assume they will be enough for the majority of the projects.

Of course, these aren’t available if you’re running your own instance, you can of course run your own. The GitLab CI/CD for GitHub setup is of course available for any GitLab instance. I don’t run one because it requires a lot of resources and it’s just not worth the pain to manage for me (and for now).

This post isn’t a tutorial by any means but more of a feedback on this setup: it works very well, and is much more complete than softwares like Drone. There is nearly no limits about what you can do, and I simply love it.