Github Integration

View Git Commits, Branches, and Pull Requests in Hive

John Furneaux avatar
Written by John Furneaux
Updated over a week ago

The Github integration removes the barrier of manually updating information from Github to Hive. With this integration, Hive Actions can be associated with Github Branches and automatically capture branch activity.  

Your team can quickly view and jump to commits, pull requests, and branches from Hive.

The workflow can also be automated so that an action's status in Hive updates accordingly when a pull request is opened, closed, and merged,

Setting up the integration

Workspace admins can enable the Github integration for your workspace from the Hive 'Apps' page:

Once Github is toggled on from the Hive Apps menu, click the 'Open' button to manage the integration.

To connect Hive with Github, Hive uses Github's Webhook functionality. You'll need to copy the Github Payload URL from Hive:

Next, go to the Github repository you want to connect with and select "Settings":

Then select "Webhooks":

Select "Add webhook":

From here, you'll need to fill in the webhook fields as follows:

  • Payload URL: Use the URL copied from Hive

  • Content type: Select "application/json"

  • Secret: Go back to Hive, copy the "Github secret" field, and paste it here

  • Finally, select the "Send me everything" option and add the webhook.

It should look something like this:

Associating Hive Actions with Github Branches
Once enabled, the Github Integration will show a new section when you open Actions in Hive. If you open an action, you'll see a new button to 'Attach branch':

From here, you can enter a branch name you'd like to track:

Once added, any branch activity which happens after initial integration setup will appear on the Action:

Once Hive catches activity on the branch, this area will populate with that activity and provide quick links to it. You'll also have quick links to view the branch or pull request on Github from here.

Automatically update the status of Hive Actions from Github Events

One of the primary benefits of the integration is the ability to automatically update Hive Action statuses on events like pull request open, close, and merge.

Let's assume the following example workflow to demonstrate how this works:

  • You have a project which has the following statuses:

    • Unstarted

    • In Development

    • Ready for Review

    • Completed

  • Your team's git workflow for a new story is:

    • (1) You have a stable branch in Github called "master".

    • (2) You check out a new branch, we'll call it "feature/add-login-screen", off of the stable branch "master".

    • (3) Changes are committed and pushed on the feature branch to implement the story.

    • (4) A pull request is opened to merge changes from "feature/add-login-screen" into "master".

You can use Hive's Github Event Handlers to automatically update the Status of an Action in Hive when a Pull Request in Github is opened, merged, or closed.

For this example, we'll assume we have an Action in Hive which has the "feature/add-login-screen" attached as its Github branch, and we'll want to update the Status of the Action in Hive to "Ready for Review" when we open a Pull Request in Github where the branch the Pull Request is merging changes into is "master".

To configure this example, go to the Github Integration menu and select "Add event handler":

From here you can select the event you want to listen to. In this case we'll select "When a pull request is opened".

Next, we'll select the status we want to set the associated action to. We'll select our custom status of "Ready for Review":

Once we save the event handler, you can test it by doing the following flow:

1. Create an Action in Hive called "Add a new login screen"

2. On that Action in Hive, open the Github integration and attach the branch name we'll be using for implementing this feature, "feature/add-login-screen"

3. In Github, checkout a new branch called "feature/add-login-screen"

4. On the new branch, commit and push your changes

5. In Github, open a new Pull Request to propose merging the changes from the "feature/add-login-screen" branch => into the "master" branch

At this point, the Github Event Handler in Hive should automatically update the Status of the Action in Hive to "Ready for Review" (so long as the "feature/add-login-screen" branch was attached to the Action in Hive).

Add branches from different repositories to a card

For each repository you'd like to make available to your workspace, follow the steps above to set up the Github webhooks.

Then, on an action card, simply prefix the branch names with the repository name.

Let's say we have connected two repositories: HiveWeb and HiveDesktop.

On an action card, click the Github integration icon and add "HiveWeb:feature/branch-name".

Click the add icon again to add a branch from the other repository, such as "HiveDesktop:feature/branch-name".

Now both branches are tracked in Hive!

Did this answer your question?