# GitHub

Hava has published an Action to make it easier to integrate Hava with a CI/CD pipeline. It allows you trigger a synchronization of one of your sources as part of your workflow execution, and optionally export a PNG image of the updated environment that can be committed to your documents folder to keep it up to date and in sync with your code changes.

The latest version of `hava-sync-action` can be found on the [GitHub marketplace](https://github.com/marketplace/actions/hava-sync-action).

## Usage

To use the action as part of your workflow, you need to create a step in your job like below

```yaml
jobs:
  sync:
    runs-on: ubuntu-latest

    steps:
      - uses: teamhava/hava-sync-action@v1
        with:
          source_id: ${{ secrets.HAVA_SOURCE_ID }}
          hava_token: ${{ secrets.HAVA_API_TOKEN }}
          environment_id: ${{ secrets.HAVA_ENV_ID }}
          view_type: "infrastructure"
```

This is a minimal setup for the action, details on all the settings can be found in the [marketplace listing](https://github.com/marketplace/actions/hava-sync-action) and our [public github repository](https://github.com/teamhava/hava-sync-action).

You can also see an implementation of the action in our [public example repository](https://github.com/teamhava/example-github-action).

## Getting Configuration Values

The action requires a few configuration values that you need to know before you implement this in your own repository: The ID of the source you are synchronizing, the ID of the environment you are exporting an image of, and a token to access the Hava API

### Hava API Token

To generate a new API token, follow the guide in our [developer documentation](https://developer.hava.io/api/authentication).

### Source ID

There are two main ways to get the ID of a source, you can either use the API to get a list of all sources and their ID, or you can use the search bar in the Hava app

#### Using the API

The Hava API has a /source endpoint that can be accessed on `https://api.hava.io/sources` to get the list. See our [API documentation](https://app.swaggerhub.com/apis-docs/H252/hava/1.1.0#/Sources/sources%23index) for more detail

#### Using the App UI

When you search using the `source:` key in the Hava application it will list all the available options for you like in the below screenshot. Select the source you are looking for and the ID will be added to the search query. You can now copy this and use it in your workflow

<figure><img src="/files/PJVTdzgEUiuwD9pZ0MD1" alt=""><figcaption><p>Source search auto complete</p></figcaption></figure>

### Environment ID

The environment ID is available as part of the URL when you click on an environment  in the Hava application. Copy the the portion of the URL that is highlighted below, it's a UUID.

<figure><img src="/files/pBiDZ2qSyMNJ0Afer2P9" alt=""><figcaption><p>Example of the environment ID in the URL</p></figcaption></figure>


---

# 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.hava.io/integrations/github.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.
