Have more control over your CI/CD setup with Codemagic GitHub app

Sep 25, 2019

Codemagic CI/CD is now available as a GitHub app! If you’re not a Codemagic user yet, you can easily become one by installing the app via GitHub. Read on and find out what advantages the Codemagic GitHub app integration (beta) has to offer.

Install Codemagic via GitHub Marketplace

Why install Codemagic CI/CD GitHub app?

With the GitHub app, you have greater control over the permissions you give and the resources you share with Codemagic.

When signing up to Codemagic via codemagic.io using a GitHub account, we use OAuth to request access to your account. Due to predefined OAuth scopes, Codemagic is forced to ask for more permissions than it actually uses. The repo scope we request grants us full access to your private and public repositories, which we need in order to list your repositories and commit history, create webhooks and run automatic builds.

With the Codemagic GitHub app, we have more flexibility limiting the scope and can ask only for the permissions we actually use. Instead of read and write access, we request read access to your code. Additionally, during the installation, you can give Codemagic access to only select repositories without cluttering the Codemagic dashboard with irrelevant repositories.

Here’s the scope of permissions we require when installing the Codemagic CI/CD app on GitHub.

In addition, you can also use the GitHub app to simply sign up to Codemagic without granting access to your repositories and only build team apps or apps from custom sources. Read more about it under Option 2 in the following section.

How do I set it up?

There are two options for installing the Codemagic CI/CD GitHub app.

Option 1: Install Codemagic CI/CD on GitHub

  1. Log in to your GitHub account.
  2. Open the Codemagic CI/CD app on Marketplace.
  3. Scroll down and click Install it for free.
  4. Review your order and click Complete order and begin installation.
  5. Next, select the repositories to which you give Codemagic access and click Install & Authorize to finish installation.

That’s it, you will then be logged in and redirected to your Applications page on Codemagic so that you can start building right away. The next time you want to log in to Codemagic via the GitHub app, you can click the Log in with GitHub App link on the login page.

You can reconfigure Codemagic CI/CD app on GitHub and make changes to the list of shared repositories anytime by navigating to Settings > Applications > Installed GitHub Apps, or by going to https://github.com/apps/codemagic-ci-cd.

Option 2. Sign up to Codemagic using GitHub app

Alternatively, you can also click Join using GitHub App at codemagic.io/signup. You will be authorized via GitHub but would have to install the Codemagic CI/CD GitHub app and grant access to repositories separately.

In Codemagic, go to User settings > Integrations and click Install GitHub App.

You will be redirected to GitHub to finish the installation.

Note that after signing up using the GitHub app, you can also proceed without installing the app. You can use this option to become a member of someone’s team in Codemagic to build the apps shared with the team or build apps that are added from custom sources.

How does installing Codemagic on GitHub affect my existing Codemagic account?

If you restrict Codemagic’s access to some repositories, you will still see all your apps and build history but won’t be able to build the apps to which Codemagic no longer has access. Such apps will be grayed out and will show up with the Removed from repository filter. Apps connected through your Bitbucket or GitLab account as well as apps added from custom sources will remain available as is.

With team apps hosted on GitHub, the situation is a bit trickier. Whether or not the repositories remain available for the team depends on the team’s integrations. If you see GitHub connected under Team integrations in team settings, then Codemagic has full access to all the repositories on the connected account (be it the team owner’s account or another) as we use OAuth permissions for the integration. If, however, there is no active GitHub integration, the repositories are accessed using the team owner’s account and any configured restrictions to repositories apply. In short, the repository restrictions configured for Codemagic CI/CD GitHub app apply to team apps only if there is no GitHub integration set up in team settings.

Team owner's account will be used to access team's apps if there is no GitHub integration
Team owner's account will be used to access team's apps if there is no GitHub integration

Currently, Codemagic has no way of knowing whether it has access to team apps before the build is started. Due to this, team apps to which you have revoked access in the GitHub app may not appear grayed out in the UI.

Are there any differences in the service when using the Codemagic CI/CD GitHub app?

The only major difference between using Codemagic with the GitHub app and via OAuth currently is in the scope of permissions and shared repositories. With regard to service, there are no differences and you can enjoy all the same features with the GitHub app as when authenticating via OAuth. However, having a GitHub app enables us to fine-tune the integration with GitHub and add additional features in the future, such as custom checks for PRs, and more, so stay tuned!

Give Codemagic GitHub app a go

We value your privacy and are happy to give you a greater control over your CI/CD integration. Installing the app doesn’t cost you anything and the same pricing applies as when you sign up via codemagic.io. With the promise of additional CI/CD features in the future and greater customization of your CI flow in mind, why not give Codemagic GitHub app a go?

Codemagic CI for Flutter