> ## Documentation Index
> Fetch the complete documentation index at: https://hub-docs.wundergraph.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GitHub

> Integrate your GitHub repositories with the subgraphs in WunderGraph Hub

The GitHub integration is a powerful feature that bridges your GraphQL schema management with your development workflow. This integration allows you to automatically sync schema in proposals with GitHub repositories, streamlining your development process and keeping your schemas in sync with your codebase.

## Setup and Configuration

<Steps>
  <Step title="Naviagate to the &#x22;Integrations&#x22; tab under &#x22;Settings&#x22;." />

  <Step title="Click on the &#x22;Connect GitHub&#x22; button.">
    <img src="https://mintcdn.com/wundergraphhub/-jQI1JMT_pnsyeFl/images/github/integration_page.png?fit=max&auto=format&n=-jQI1JMT_pnsyeFl&q=85&s=ae017093c208ba834db0005fe5054388" alt="GitHub Integration" width="2880" height="1684" data-path="images/github/integration_page.png" />
  </Step>

  <Step title="You will be redirected to GitHub to authorize the WunderGraph Hub application.">
    You can either select 'All repositories' or 'Select repositories' to connect the repositories you want to connect to the subgraphs in WunderGraph Hub.

    <img src="https://mintcdn.com/wundergraphhub/Dr9oVUeC-0tFehUp/images/github/github_app_installation.png?fit=max&auto=format&n=Dr9oVUeC-0tFehUp&q=85&s=deccf688925429ffab2ce3a270505ce3" alt="GitHub App Installation" width="3428" height="1914" data-path="images/github/github_app_installation.png" />
  </Step>

  <Step title="Once authorized, you will be redirected back to the WunderGraph Hub." />

  <Step title="Now you can navigate to any of your graphs, Click on the dropdown on the top left corner, select &#x22;Integrations&#x22; and select &#x22;Git&#x22;.">
    <img src="https://mintcdn.com/wundergraphhub/-jQI1JMT_pnsyeFl/images/git/settings.png?fit=max&auto=format&n=-jQI1JMT_pnsyeFl&q=85&s=eeb3ef873baef06c3495baa00f341da3" alt="Graph GitHub Settings" width="1502" height="865" data-path="images/git/settings.png" />
  </Step>

  <Step title="You can now select the repositories you want to connect to the subgraphs in WunderGraph Hub." />

  <Step title="Once you have selected the repositories, you can click on the &#x22;Save Mappings&#x22; button to connect the repositories to the subgraphs in WunderGraph Hub.">
    This will create an initialization PRs in all the selected repositories with the respective subgraph schema.

    <img src="https://mintcdn.com/wundergraphhub/-jQI1JMT_pnsyeFl/images/git/mappings.png?fit=max&auto=format&n=-jQI1JMT_pnsyeFl&q=85&s=6824c8f61ee7891fea130573380493a7" alt="Graph GitHub Mappings" width="800" height="955" data-path="images/git/mappings.png" />
  </Step>
</Steps>

## Pull Request Lifecycle

The GitHub integration automatically synchronizes pull request states with your schema proposal status, ensuring your development workflow stays aligned with your schema management process.

**Pull Request State Management:**

| State                | Behavior                                                                                                                                        |
| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| **Ready for Review** | When a proposal is created in opened state, a pull request is automatically created in "ready for review" state across all mapped repositories. |
| **Draft**            | When a proposal is moved to draft state, the pull request transitions to draft state.                                                           |
| **Closed**           | When the proposal is closed, the corresponding pull request is also closed.                                                                     |
| **Reopened**         | If a closed proposal is reopened, the pull request is also reopened.                                                                            |

## How It Works

### Streamlined Development Workflow

The GitHub integration eliminates the friction between schema design and implementation by automatically creating branches in your mapped repositories whenever a schema proposal is made. This means developers can immediately start implementing changes without manual setup.

### Automatic Pull Request Creation

When a schema proposal is created in the hub, the integration automatically:

* Creates a new branch in the mapped repository
* Stores the proposed schema files directly in the branch
* Creates a pull request with the schema changes on new changes after creating a proposal or by openning the proposal.
