Meet the Bit.dev GitHub Integration — Get Automatic PRs for Component Updates

February 02, 2020 0 Comments

Meet the Bit.dev GitHub Integration — Get Automatic PRs for Component Updates

 

 

Tally Barak

Bit.dev now provides integration with GitHub. This integration lets you get automated PRs to update projects with the latest component versions.

Component consumers can get automated PRs for new versions of components, and effortlessly keep their components up to date.

Component maintainers can gain visibility into their component’s usage and adoption, to learn which PRs were merged and who’s lagging behind.

Let BitdevBot work for you

This new feature is possible thanks to “BitdevBot”, a GitHub bot that helps in ensuring all GitHub projects contain the latest versions of shared components.

BitdevBot tracks both collections of components and their consuming GitHub repositories. When a component gets a new version, the Bot responds by creating the relevant PRs for all connected (consuming) repositories.

To get started just visit your Bit.dev organization and click “Integrations”. To learn more keep reading below.

Benefits

Component consumers get a simplified process. Instead of doing the hard labor themselves, checking for updates and creating PRs for the components, they get a ready-made PR with all their updates.

The PRs are acting as push notifications when changes occur. If the repository is associated with a CI / CD process, the PR triggers a CI process, so the user can know upfront if the update causes the app to break.

Quickly fork and edit components. Get updates and merge changes.

Use bit import to quick-fork components into your project for local editing. Leverage BitdevBot to get PRs for new components updates on top of your local changes, merge code changes, resolve conflicts, and learn if you can return to the main track.

Component Maintainers

The Bot log view shows all PRs made for all components. Library maintainers can track the adoption of a new component and communicate with the project owners in case they did not apply the changes to their projects.

Process

  1. In your bit.dev organization’s settings, select the integrations tab. This is only available to users that have admin privileges in the organization.
  2. Select Github and authorize the Bot to access the relevant repositories.
  3. Select the collection that contains the components and the repositories where the Bot can create PRs. You can select a specific repository or all the authorized repositories. For each repository or repositories, select the branch on which the PRs are created.

That is it. The Bot is now tracking collection exports and create PRs.

Flow

Projects can consume Bit components in one of two ways:

  • By installing the component as NPM package installed via NPM (or Yarn)
  • By importing the Bit component into a project with its source code and building it locally (or using the cached build coming with the code).

Bit.dev is watching the registered collections and whenever new versions of components are exported to it, it will go through all the connected repositories and do one of the following:

  • In projects that consume the component as an NPM package, it installs the latest version and saves the package.json and lock file.
  • In projects that consume the component as source code (import), it imports the latest version and attempts merging the most recent version.

When the user run the following command:

$ bit export owner.collection

Bit reviews all the components exported in the command and creates and updates PRs accordingly:

If an open PR exists for all the components that are included in the export command, the PR is updated with the latest changes. Otherwise, a new PR is created for all the components.

In addition, all the open PRs that contain any of the exported components are also updated to the recent version.

PRs are created for each of the repositories that are linked to the collection and contain the components.

The application developer now has the ability to get related changes to components as PR and make the decision which of the PRs need to apply to the project.

PR contents

The PR name is as follow:

  • If the PR contains a single component, the name is:
Update <component id>
  • If the PR contains multiple components, the name is
Update 3 Bit components //or the relevant number of components

The PR discussion contains a list of all the components that are updated.

Tracking

Organization admin can track all the PRs that were created for the organization. For each PR, the Git status is available to see if the PR is open, merged, or closed (without merge).

GitLab and BitBucket integrations

Coming up soon!

Learn More


Tag cloud