Send GitHub events to Tinybird¶
GitHub is a platform for building and deploying web applications. By integrating GitHub with Tinybird, you can analyze your GitHub events in real time and enrich it with other data sources.
Some common use cases for sending GitHub events to Tinybird include:
- Analyze GitHub issues and pull requests.
- Analyze GitHub push events.
- Analyze and monitor GitHub pipeline.
- Analyze custom DORA metrics.
All this allows you to build a more complete picture of your GitHub events and improve your DevOps processes.
Read on to learn how to send events from GitHub to Tinybird.
Before you start¶
Before you connect GitHub to Tinybird, ensure:
- You have a GitHub account.
- You have a Tinybird Workspace.
Connect GitHub to Tinybird¶
GitHub provides a variety of webhooks (+70) that you can use to send events to Tinybird at organization, repository or application level.
This guide covers the base case for sending GitHub events from a repository to Tinybird.
In GitHub, go to your repository Settings > Webhooks.
Select Add webhook.
Webhooks payloads vary depending on the event type. You can check here the list of GitHub events.
Select Send me everything.
- In Tinybird, create a Data Source, called
github
with the following schema:
SCHEMA > `ingest_timestamp` DateTime `json:$.time` DEFAULT now(), `record` JSON `json:$` ENGINE "MergeTree" ENGINE_SORTING_KEY "ingest_timestamp" ENGINE_TTL "" ENGINE_PARTITION_KEY ""
There's a single record
column using the JSON Data Type to store the semi-structured data you receive from GitHub webhooks in a single column. You can later retrieve various events and their metadata as needed in your Pipes.
In Tinybird, copy a token with privileges to append to the Data Source you created. You can use the admin token or create one with the required scope.
Back in GitHub, paste the Events API URL in your Webhook URL. Use the query parameter
name
to match the name of the Data Source you created in Tinybird.
https://api.tinybird.co/v0/events?name=github&token=<your user token>
Replace the Tinybird API hostname or region with the API region that matches your Workspace.
Select application/json as the content type.
You're done.
Check the status of the integration from the Recent deliveries
in the GitHub webhooks panel or from the Log tab in the Tinybird github
Data Source.