# Github integration

### Introduction

You can integrate Flagship with Github in order to synchronize your Flag references in your codebase with Flagship.

Using the [Codebase Analyzer](/server-side/integrations/codebase-analyzer.md), Flagship can look through your entire codebase in order to check for the reference of the flag inside your code.\
The Flag references are then sent back to Flagship in order for you to view their references on the Flag page on the Flagship Platform.

### How to integrate Flagship with Github

You can set up the codebase analyzer to run on a specific step of your Github CI pipeline:

`.github/workflows/main.yml` example:

```yaml
on: [push]

jobs:
  flagship_flag_references:
    runs-on: ubuntu-latest
    name: A job to say hello
    steps:
    - name: Sync Flag References
      id: sync-flag-references
      uses: flagship.io/codebase-analyzer-action@v1
      with:
        flagshipClientId: ${{ secrets.FLAGSHIP_CLIENT_ID }}
        flagshipClientSecret: ${{ secrets.FLAGSHIP_CLIENT_SECRET }}
        environmentId: ${{ secrets.FLAGSHIP_ENV_ID }}
        accountId: ${{ secrets.FLAGSHIP_ACCOUNT_ID }}
        repositoryUrl: '${{ env.GITHUB_SERVER_URL }}/${{ env.GITHUB_REPOSITORY }}'
        repositoryBranch: ${{ env.GITHUB_REF }}
```

For that integration you will need to fill out those parameters:

* **repositoryUrl**: the URL of the repository you want to analyze. This is needed in order to display the link to your flag reference inside the Flag page of the Flagship platform.
* **repositoryBranch**: the branch of the repository you want to analyze. This is needed in order to display the link to your flag reference inside the Flag page of the Flagship platform.
* **flagshipClientId**: the Flagship API Client ID needed for the codebase analyzer to communicate Flag references to Flagship. [Remote Control API](/server-side/remote-control-api.md) for more details.
* **flagshipClientSecret**: the Flagship API Client ID needed for the codebase analyzer to communicate Flag references to Flagship. [Remote Control API](/server-side/remote-control-api.md) for more details.
* **environmentId**: the Flagship environment ID needed for the codebase analyzer to communicate Flag references to Flagship. You can get the environment ID in the platform on Settings -> API Key & Settings
* **accountId**: the Flagship account ID needed for the codebase analyzer to communicate Flag references to Flagship. You can get the environment ID in the platform on Settings -> Account

You can set up additional parameters to the Action to customize further your integration. [See Github Repository](https://github.com/flagship-io/codebase-analyzer-action) for more details.

Any feedback? [We would be really happy to have a quick chat!](mailto:product.feedback@abtasty.com?subject=Flagship%20Github%20Integration%20Feedback)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.abtasty.com/server-side/integrations/codebase-analyzer/github-integration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
