
## Add contract impact analysis in GitHub

URL: https://docs.atlan.com/product/capabilities/governance/contracts/how-tos/add-contract-impact-analysis-in-github

> Add contract impact analysis to GitHub pull requests using the Atlan GitHub Action. Setup requires an API token or OAuth client with persona and metadata policy permissions.

# Add contract impact analysis in GitHub 

Identify how modifications to [data contracts](https://docs.atlan.com/llms/governance/contracts/create-data-contracts/llms.txt) might impact downstream processes and data quality using the [Atlan GitHub Action](https://github.com/marketplace/actions/atlan-action). This action places impact analysis directly into your pull request, allowing you to view potential downstream impacts before merging changes.

## Prerequisites

1. Before running the action, you need to create an [Atlan API token](https://docs.atlan.com/llms/platform/get-started/api-authentication/llms.txt) or configure an [OAuth client](https://docs.atlan.com/llms/platform/get-started/oauth-clients/llms.txt).
2. You also need to assign a [persona](https://docs.atlan.com/llms/governance/access-control/create-a-persona/llms.txt) to the API token and add a [metadata policy](https://docs.atlan.com/product/capabilities/governance/access-control/metadata-policy) that provides the requisite permissions on assets for the Atlan action to work. For example, you can add the following permissions:
 - Asset, such as a table - _Read_ only
 - Any downstream connections, such as Microsoft Power BI - _Read_ only
3. You need to configure the default `GITHUB_TOKEN` permissions. Grant _Read and write permissions_ to the `GITHUB_TOKEN` in your repository to enable the `atlan-action` to seamlessly add or update comments on pull requests. Refer to [GitHub documentation](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#configuring-the-default-github_token-permissions) to learn more.

## Configure the action

To set up the Atlan action in GitHub:

1. [Create repository secrets](https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions) in your repository:
 - `ATLAN_INSTANCE_URL` with the URL of your Atlan instance.
 - `ATLAN_API_TOKEN` with the value of the API token.
2. Add the GitHub Action to your workflow:
 1. Create a workflow file in your repository - `.github/workflows/atlan-action.yml`.
 2. Add the following code to your workflow file:

 ```yaml
 name: Atlan action

 on:
 pull_request:
 types: [opened, edited, synchronize, reopened, closed]

 jobs:
 get-downstream-impact:
 name: Get Downstream Assets
 runs-on: ubuntu-latest
 steps:
 - name: Checkout
 uses: actions/checkout@v4

 - name: Run Action
 uses: atlanhq/atlan-action@v1
 with:
 GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
 ATLAN_INSTANCE_URL: ${{secrets.ATLAN_INSTANCE_URL}}
 ATLAN_API_TOKEN: ${{secrets.ATLAN_API_TOKEN}}
 ATLAN_CONFIG: .atlan/config.yaml
 ```

## Test the action

After you've completed the configuration earlier, create a pull request with a changed [Atlan data contract](https://docs.atlan.com/llms/governance/contracts/create-data-contracts/llms.txt) file to test the action. You can see the Atlan GitHub action running and then adding comments in your pull request:

- The GitHub workflow adds and updates a single comment for every file change.
- The impacted assets in the comment are displayed in a collapsible section and grouped by source and asset type.
- The comment includes some metadata for your impacted assets - such as descriptions, owners, and linked glossary terms.
- View impacted assets directly in Atlan.

## Inputs

| Name | Description | Required |
| --- | --- | --- |
| `GITHUB_TOKEN` | For [writing comments on PRs](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#configuring-the-default-github_token-permissions) to print downstream assets | true |
| `ATLAN_INSTANCE_URL` | For making API requests to the user's tenant | true |
| `ATLAN_API_TOKEN` | For [authenticating API requests](https://docs.atlan.com/llms/platform/get-started/api-authentication/llms.txt) to the user's tenant | true |
| `ATLAN_CONFIG` | For impact analysis of [Atlan data contracts](https://docs.atlan.com/llms/governance/contracts/create-data-contracts/llms.txt), if included in a GitHub PR | true |

---
