---
title: "GitHub"
description: "Integrate Middleware with GitHub to track repository events, monitor logs, and detect errors in real-time."
section: "Integrations"
breadcrumb: "Integrations > Alerting & Collaboration > GitHub"
canonical: "https://docs.middleware.io/integrations/github-integration"
---
# GitHub

Middleware's GitHub integration brings your GitHub repositories and Middleware together, giving your team a simple way to monitor, automate, and secure your coding projects. By connecting GitHub to Middleware, you get tools to stay on top of your code, work better as a team, and catch problems fast.

It also enables you to track and monitor key events from your repositories, such as code pushes, commits, pull requests, dependabot alert, and build failures.

![GitHub Integration](/images/github/github-listing.png)

This integration connects your GitHub repositories to Middleware, offering two powerful features to enhance your development workflow and monitoring capabilities:

#### 1 App Configuration

Install a GitHub App to enable advanced functionality, including fetching issues, creating automated fixes, generating pull requests, and leveraging AI-powered solutions for your code.

#### 2 Webhook Events:

Receive real-time notifications about key activities in your GitHub repositories, such as code pushes, commits, and pull requests, displayed directly in Middleware’s log listing section.

This integration provides real-time insights, streamlines collaboration, automates workflows, and enhances project security—all within the Middleware platform.

## Prerequisites

Before setting up the GitHub integration, ensure the following requirements are met:

#### 1 Middleware Account

Middleware Account with `admin` level access

#### 2 GitHub Account:

GitHub Account with `admin` level access to the repository you wish to integrate.

#### 3 Repository Permissions:

Ensure the repository settings allow for GitHub App installation and Webhook configuration.

## App Configuration

### Overview

Set up the App Configuration feature to install a GitHub App that connects your GitHub organization or personal account to Middleware. This integration unlocks advanced capabilities such as fetching and managing issues, creating automated fixes, generating pull requests, and leveraging AI-powered solutions to optimize your code. By configuring the GitHub App, you enable Middleware to securely access your GitHub resources and collect valuable data to streamline your development workflow.

For example, once the GitHub App is installed with the appropriate permissions, you can:

- View and manage GitHub issues directly in Middleware.
- Automate fixes for identified issues and submit them as pull requests.
- Use AI-driven insights to analyze code and receive improvement suggestions—all from your Middleware dashboard.

![GitHub Integration](/images/github/github-app-config.png)

### Setup

Follow these instructions to install and authorize a GitHub App, granting Middleware permission to access resources in GitHub.

If you are an admin in your GitHub organization, you can configure GitHub Apps for your organization. Alternatively, you can create GitHub Apps with a personal GitHub account. Note that enabling certain features may require additional setup beyond creating the GitHub App. Installing the app only grants the prerequisite permissions needed for Middleware features—you won’t incur additional charges for creating the app, and no feature is enabled by default unless explicitly configured.

#### Create a GitHub App

#### 1 Open GitHub Integration

Navigate to the **Installation** > **Integration** > **GitHub Integration**, that listed under **Collaboration** section.

#### 2 Add a New App

Click on the **Add New App** button.

#### 3 Select the Source of Installation

- **Organization**: Install the app for your GitHub organization.
- **Personal Account**: Install the app for your individual GitHub account.

![GitHub Integration](/images/github/github-sources.png)

#### 4 Set Up GitHub App Permissions

- By default, Middleware requests the recommended permissions for all features.
- To customize, adjust the permissions granted to Middleware. When you change them accordingly, you will see impact on particular associated functionality. By default, Middleware selects the recommended permissions for all features. If you modify permissions and omit required ones, the affected features will get affected. You can see highlights any missing permissions and their impact on functionality.

![GitHub Integration](/images/github/github-permissions.png)

#### 5 Create the GitHub App

Click on the **Create GitHub App** button to complete the installation process at Middleware.

#### 6 Finalize the App in GitHub

In GitHub, finalize App name and press **Create GitHub App**.

#### 7 Return to Middleware

After this, you will be redirected to Middleware again.

#### Install and Authorize the GitHub App

#### 1 Find the App

Now you can see the GitHub App listed in the **App Configuration** section.

#### 2 Install the GitHub App

Click on the **Install GitHub App** button to proceed with the installation.

![GitHub Integration](/images/github/github-installation.png)

#### 3 Select Repositories

Select the repositories you want to connect with Middleware.

#### 4 Install and Authorize

Click on the **Install & Authorize** button to complete the installation process.

#### 5 Return to Middleware

Once the installation is successful, you will be redirected to Middleware.

![GitHub Integration](/images/github/github-final.png)

#### 6 Request Approval if Needed

If you don't have access to the app installation permissions, then GitHub will send your request to the organization owner for approval.

![GitHub Integration](/images/github/github-approval.png)

### Post-Installation

Once the GitHub App is installed and configured, you can immediately start using the enabled features within Middleware. For example:

- View and manage GitHub issues directly in Middleware.
- Automate fixes for identified issues and submit them as pull requests.
- Use AI-driven insights to analyze code and receive improvement suggestions to enhance your codebase.

Security Note: Middleware prioritizes your privacy and security. The GitHub App only accesses data necessary for the features you enable. You can review or adjust permissions anytime via your GitHub settings.

## Webhook Events

The Webhook Events feature lets you monitor key GitHub repository activities in real time by sending event data to Middleware’s log listing section.

### Setup

Follow these steps to set up GitHub integration with Middleware account.

#### 1 Open Webhooks in GitHub

Log in to your GitHub account and navigate to the **Settings** > **Code and Automation** > **Webhooks**.

#### 2 Add a Webhook

Click on **Add webhook**.

#### 3 Set the Payload URL

In the **Payload URL** field, paste the Middleware's **Intake Webhook URL**, appears as:

```javascript
    your-initial-uid/v1/integration/github?mw_api_key=your-initial-token
```

#### 4 Set the Content Type

Set the **Content type** to `application/json`.

#### 5 Choose Events to Track

Choose the events you want to track from the following list:

- Branch or Tag Creation
- Branch or Tag Deletion
- Commit Comments
- Dependabot Alert
- Discussion
- Discussion Comment
- Issues
- Issue Comments
- Membership
- Public - Visibility Changes
- Pull Requests
- Pull Request Reviews
- Pull Request Review Comments
- Pushes & Commits
- Releases
- Repositories
- Security and Analyses
- Sponsorship
- Team and Team Adds
- Watch

#### 6 Filter Repositories and Branches

After saving the changes on the GitHub side, specify your desired repositories and branches on the Middleware side to filter the events you want to track.

![GitHub Filter Rules](/images/github/github-filter-rules.png)

> **Note:** You can use wildcards in both fields. For example, to import events from repositories, specify `middleware/backend` or use `middleware/*`. Similarly, to import branches, list them with commas, such as `main, prod, dev`, or simply use `*`.

### Features

#### Real-Time Monitoring:

- Tracks pushes, commits, and pull requests instantly.

#### Build Failure Detection:

- Detects and alerts on build failures or system issues caused by code changes.

#### Enhanced Collaboration:

- Facilitates discussions and reviews directly within your workflow.

#### Incident Management:

- Links code events to new or existing incidents.

#### Security Monitoring:

- Monitors repository vulnerability alerts and collaborator changes.

![GitHub Events](/images/github/github-events.png)

![GitHub Event Side Panel](/images/github/github-side-panel.png)

### GitHub Event Mappings

Middleware maps all supported GitHub events to corresponding log types on Middleware's logs screen. Each event is categorized by its action type and assigned a log level, such as info, warning, error, or debug. This ensures that events are appropriately flagged and prioritized for review. Below is an example of how some events are mapped:

- Create Branch/Tag Event: Marked as **Info** log.
- Delete Branch/Tag Event: Marked as **Error** log.
- Pull Request Event:

  - `opened` : Marked as **Info** log.
  - `closed` : Marked as **Error** log.
  - `locked`, `unlocked`, `unassigned`, `unlabeled` : Marked as **Warning** log.
  - `ready_for_review`, `review_requested`, `review_request_removed` : Marked as **Debug** log.
- Push Event: Marked as **Info** log.
- Issue Event: Marked as **Error** log.
- Release Event:

  - `created`, `published`, `released` : Marked as **Info** log.
  - `edited` : Marked as **Warning** log.
  - `deleted` : Marked as **Error** log.

### Troubleshooting

Common Issues and Solutions

1. Webhook Not Triggering Events:

   - Verify the **Payload URL** in GitHub settings.
   - Ensure the events you wish to track are selected.
2. Missing Insights on Middleware Dashboard:

   - Check if the webhook is active in GitHub.
   - Verify that the repository and branch names are correctly entered in Middleware.
3. Security Alerts Not Captured:

   - Ensure security-related events like `Dependabot Alerts` and `Security and Analyses` are enabled.
4. Incorrect Data Format:

   - Set the Content type to `application/json` when configuring the webhook.

Need assistance or want to learn more about Middleware? Get in touch with us via our Contact Us page or join our Slack channel.
