Send GitHub events to Chronosphere

To send GitHub events to Chronosphere, create a webhook within GitHub and include your API key to authenticate with Chronosphere. For more information, refer to webhook events and payloads (opens in a new tab) in the GitHub documentation.

Obtain an API token

Before sending events from GitHub, contact Chronosphere Support to obtain an API token for use with authenticating your third-party app with Chronosphere.

This API token differs from an API token that's generated when creating a service account.

Create a GitHub webhook

To send GitHub events to Chronosphere:

  1. In GitHub, open the repository you want to configure a webhook for.

  2. Click Settings.

  3. Under Code and automation, click Webhooks.

  4. In the Add webhook window, in the Payload URL field, enter https://ADDRESS.chronosphere.io/api/v1/data/events/receiver/github

    Replace ADDRESS with your company name prefixed to your Chronosphere instance that ends in .chronosphere.io. For example, MY_COMPANY.chronosphere.io.

  5. Select application/json as the Content type.

  6. In the Secret field, enter the API token you obtained from Chronosphere Support.

  7. Choose Let me select individual events, and then select Deployment and Deployment Status as the events to trigger the webhook.

  8. Save your webhook.

Map GitHub events to Chronosphere events

After creating a GitHub webhook to send events to Chronosphere, you can use the Chronosphere app or CreateEvent API to create change events.

Chronosphere automatically maps the GitHub payload to change events in Chronosphere. You can't customize how the payload maps to change events. If you want to modify how the GitHub payload gets mapped, contact Chronosphere Customer Success.

The following table indicates the fields and values required to create a GitHub event in Chronosphere:

FieldValue
categorydeploys
typedeploy_ACTION
sourcegithub
happened_atTIMESTAMP
titleTITLE

Replace the following:

  • ACTION: The type of deploy event to create, such as deploy_start, deploy_in_progress, or deploy_end.
  • TIMESTAMP: The time event occurred, which must be between 24 hours in the past or 24 hours in the future. Defaults to now if not specified.
  • TITLE: A short description of the event that occurred, such as a commit message of a code deploy.

The following sample request creates a deploy event from GitHub with a type of deploy_start. Chronosphere maps the environment, deploy.sha, and deploy.log_url labels by default.

curl --request POST \
  --url https://ADDRESS.chronosphere.io/api/v1/data/events \
  --header "API-Token: $CHRONOSPHERE_API_TOKEN" \
  --data '{
  "event": {
    "category": "deploys",
    "happened_at": "2024-07-24T14:15:22Z",
    "payload": {},
    "labels": {
      "environment": "staging",
      "deploy.sha": "fr123456f5g1234c2e01c12345f5bc1a2bf0g40"
      "deploy.log_url": "https://link_to_github_deploy_event"
    },
    "source": "github",
    "title": "Deploy to staging environment",
    "type": "deploy_start"
  }'
}