# @hero-design/snowflake-guard

> A GitHub App built with [Probot](https://github.com/probot/probot) that analyzes PR changes and reports snowflake usage of Hero Design components.

## Setup

1. Copy `.env.example` to `.env` and asks Andromeda team for variable details.

```sh
cp .env.example .env
```

For React Native projects, include your repo name in the `MOBILE_REPO_NAMES` env.

2. Set up [internal-tool-integrations service](https://github.com/Thinkei/internal-tool-integrations) for the bot to store report.

- Replace `DB_HOST` with the host of the internal-tool-integrations service.
- Use the same `SNOWFLAKE_GUARD_SECRET` as the one in the internal-tool-integrations service.

In case you don't want to store snowflake report, comment out the `saving report` section in `src/index.ts`.

3. Install snowflake-guard[Dev] [app](https://github.com/apps/hero-design-snowflake-guard-dev) to a repository that you wish to run the app on.

4. Start `internal-tool-integrations` service.

5. Start the bot.

```sh
# Install dependencies
yarn install

# Run the bot
yarn start
```
6. Open or update a pull request to trigger webhook events.

## Note

This bot does not support hot-reload yet, please restart the app once you make any changes to the code.
