GitHub integration for Orbit for anyone with multiple communities
Tags: github, orbit, community, actionshackathon21
Published: 2021-11-24 13:44:13

[Orbit](https://orbit.love) is "mission control for your community", a single, shared view of members and activity. 

For my work for k6 I've been adding integrations to our Orbit "workspace" so that I can make correlations between data points, and to act accordingly. 

For instance: this person asking a question on Twitter, posted the same question in our Discourse, let's link to our explanation in our reply. Discourse after all allows for more characters than Twitter, and anyone passing by might learn about our community Discourse and check it out. 

I've used the [GitHub Actions workflow](https://www.github.com/orbit-love/github-actions-templates) for this, which is just adding a bunch of YAML files and "secrets" to a personal repo.

![YAML files in a repository](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/62rm7q2xd8ax02key5iq.png)

Next I wanted to hook up our public repositories on GitHub, to scan those for activity, and I ran into an issue. k6 was recently acquired by Grafana Labs, and in August we moved all k6 repositories under the Grafana Labs organization on GitHub. Grafana uses Orbit to listen to all the repos in that organization, and it seems Orbit can't send data from one organization to two different workspaces. 

Nicolas Goutay, Sr. Software Engineer, Ben Greenberg, (their former) Developer Advocate, and  Josh Dzielak, Co-Founder & CTO, responded unanimously to [my request](https://twitter.com/FloorDrees/status/1443137807560679431): it's just not possible. Yet.  

Now I think Orbit should give this feature request some priority, because I think that many larger (open source) players have multiple product communities they support - Grafana has Prometheus, Grafana itself, Tempo, etc, Red Hat has OpenShift, OpenStack, Ansible, HashiCorp has Consul, Terraform, Vagrant. Currently information on all these different project feed into one workspace and I can imagine the signal-to-noise ratio is... not great. 

Colleague, and Tempo maintainer, Daniel González Lopes to the rescue! Part of the SRE team at k6, Daniel helped me (ab)use the [GitHub API](https://docs.github.com/en/rest) to search GitHub for public Grafana repos with "k6" in the name, and get all the recent events for each one of them.

From those events we create new members (or update them if they already exist), and create new activities for each one of them. While functional in the first iteration, Daniel spent some time to update the activity types to be more legible / without all the breadcrumb info.

Before:
![Activity graph before](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d460bjeomuvpc0zjvq4k.png)

After:
![Activity graph after](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xncdpi62apxdz4v41bpc.png)

We're hoping tags in Orbit Activities will help to filter by repo in the future. But in Orbit's [reference material](https://docs.orbit.love/reference/post_-workspace-id-activities) tags are marked as "experimental". In all caps.

Anyway, the idea is that we for this as well use GitHub Actions. We'll let the implementation simmer for a few weeks, make tweaks here and there, and the gradually add the other integrations. With every integration we add we expect to see duplication, and I'd rather deal with those on a case by case basis, than to go through 300+ possible matches at once.

"Fun" anecdote: Daniel thought it'd be neat to use "starring a repo" as an activity as well, which exposed some rate limits on Orbit's end. We plan to run the script hourly, to avoid big data (not to be confused with Big Data) imports moving forward.

Orbit's reports / graphs are pretty rudimentary, so I would love to see *someone* create an Orbit data source plugin for Grafana. Imagine being able to view community data with your other project's health metrics... Looking at [Marcus Olsson](https://twitter.com/marcusolsson) 👀

Our little integration [lives on GitHub](https://github.com/grafana/orbit-github-integration) for you to fork, copy, or take inspiration from.