Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.

chore: update and improve README.md #844

Merged
merged 38 commits into from
Nov 9, 2023
Merged
Changes from 12 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
71a1619
chore: update README.md
molecula451 Sep 27, 2023
dc05fe4
Merge branch 'development' into update-readme
molecula451 Sep 27, 2023
9a9cee8
chore: add metadata
molecula451 Sep 29, 2023
2bd1e8a
chore: update architecture overview
molecula451 Sep 29, 2023
b47d264
test: improve readme
molecula451 Oct 3, 2023
a972e30
Merge branch 'ubiquity:development' into update-readme
molecula451 Oct 3, 2023
339af31
test: update
molecula451 Oct 4, 2023
9db31ab
test: update readme
molecula451 Oct 6, 2023
51b0c35
test: update
molecula451 Oct 6, 2023
0445dda
test: update
molecula451 Oct 6, 2023
cbec52d
test: update
molecula451 Oct 6, 2023
9288bc7
test: update
molecula451 Oct 8, 2023
c1c24bb
test: update readme
molecula451 Oct 12, 2023
097bc73
Merge branch 'development' into update-readme
molecula451 Oct 12, 2023
975f5d1
Merge branch 'development' into update-readme
molecula451 Oct 13, 2023
b454f80
Merge branch 'ubiquity:development' into update-readme
molecula451 Oct 19, 2023
d2a1955
test: remove logna, update supabase
molecula451 Oct 22, 2023
46865f6
test: remove logna
molecula451 Oct 22, 2023
91b18e1
Merge branch 'ubiquity:development' into update-readme
molecula451 Oct 25, 2023
479f031
test: update
molecula451 Oct 25, 2023
9ff9f10
test: update
molecula451 Oct 25, 2023
f657258
test: update
molecula451 Oct 25, 2023
bdc29ca
test: update
molecula451 Oct 25, 2023
c67738d
test: update
molecula451 Oct 25, 2023
448371a
test: update
molecula451 Oct 25, 2023
7467ed3
test: update
molecula451 Oct 25, 2023
59bfe74
test: update
molecula451 Oct 25, 2023
7f1544a
test: update
molecula451 Oct 25, 2023
ad73884
test: update
molecula451 Oct 25, 2023
2b6a208
test: update
molecula451 Oct 25, 2023
fe3861b
test: update
molecula451 Oct 25, 2023
6c24f5d
test: update
molecula451 Oct 25, 2023
2e83bb6
test: update
molecula451 Oct 25, 2023
601dc97
test: update
molecula451 Oct 25, 2023
7013207
test: update readme
molecula451 Oct 25, 2023
3e50e15
test: update readme
molecula451 Oct 25, 2023
262a347
test: update readme
molecula451 Oct 25, 2023
be0af73
test: update readme
molecula451 Oct 25, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
153 changes: 120 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
# The UbiquiBot

Ubiquity DAO's GitHub Bot to automate DevPool management.
# UbiquiBot

Ubiquity DAO's GitHub Bot for Automating DevPool Management.

## Table of Contents
1. [Quickstart](#quickstart)
2. [Environment Variables](#environment-variables)
3. [Overview](#overview)
4. [How to Use](#how-to-use)
5. [Configuration](#configuration)
6. [How to Run Locally](#how-to-run-locally)
7. [Supabase Database](#supabase-database)
8. [Logs](#logs)
9. [Payments Permits in a Local Instance](#payments-permits-in-a-local-instance)
10. [How to QA Additions to the Bot](#how-to-qa-additions-to-the-bot)
11. [How to Create a New Release](#how-to-create-a-new-release)
12. [Architecture Overview](#architecture-overview)
13. [Default Config Notes (`ubiquibot-config-default.ts`)](#default-config-notes-ubiquibot-config-defaultts)

## Quickstart

Expand All @@ -10,17 +25,19 @@ Ubiquity DAO's GitHub Bot to automate DevPool management.
git clone https://github.com/ubiquity/ubiquibot.git
cd ubiquibot
yarn
yarn build
yarn build (to compile your changes)

yarn build --watch (to locally auto compile your changes)
yarn start:watch
```

## Environment Variables

- Copy `.env.example` to `.env`
- Update `.env` with the following fields:
- Copy `.env.example` to `.env` (do not rname .env.example, just make a copy)
molecula451 marked this conversation as resolved.
Show resolved Hide resolved
- Update the following fields on `.env`:
- `SUPABASE_URL`: Add your Supabase project URL.
- `SUPABASE_KEY`: Add your Supabase project API key.
- `LOGDNA_INGESTION_KEY`: Get it from [Memzo](https://app.mezmo.com/) by creating an account, adding an organization, and copying the ingestion key on the next screen.
- `LOGDNA_INGESTION_KEY`: Get it from [Mezmo](https://app.mezmo.com/) by creating an account, adding an organization, and copying the ingestion key.
- `FOLLOWUP_TIME`: (optional) Set a custom follow-up time (default: 4 days).
- `DISQUALIFY_TIME`: (optional) Set a custom disqualify time (default: 7 days).
- `OPENAI_API_HOST`: (optional) Set OpenAI host url (default: https://api.openai.com).
Expand All @@ -32,16 +49,60 @@ yarn start:watch
- `SIMILARITY_THRESHOLD`: (optional) Set similarity threshold (default: 80).
- `MEASURE_SIMILARITY_AI_TEMPERATURE`: (optional) Set ChatGPT temperature for measuring similarity (default: 0).
- `IMPORTANT_WORDS_AI_TEMPERATURE`: (optional) Set ChatGPT temperature for finding important words (default: 0).
- `WEBHOOK_PROXY_URL`: (required) should be automatically filled when you install Ubiquibot
- `WEBHOOK_SECRET`: (required) should be automatically filled when the app is installed

`APP_ID` and `PRIVATE_KEY` are [here](https://t.me/c/1588400061/1627) for core team developers to use.

`APP_ID` and `PRIVATE_KEY` are [here](https://t.me/c/1588400061/1627) for internal developers to use.
If you are an external developer, `APP_ID`and `PRIVATE_KEY` are automatically generated when you install the app on your repository.

Should output:
![setup](https://github.com/ubiquity/ubiquibot/assets/41552663/febf0e61-0402-4b25-838a-a64c1c385984)

You may proceed to go to localhost:3000 and you should see

![setup1](https://github.com/ubiquity/ubiquibot/assets/41552663/4b9d7565-8bd4-4e2a-864d-a086fedfe24d)

Click on Register a Github App

![setup3](https://github.com/ubiquity/ubiquibot/assets/41552663/0052feba-e823-419b-acde-d997d68ac553)

Provide the bot a name

![setup3](https://github.com/ubiquity/ubiquibot/assets/41552663/0052feba-e823-419b-acde-d997d68ac553)

![setup4](https://github.com/ubiquity/ubiquibot/assets/41552663/f65e166b-c3fb-4e22-9f49-d622e3922eb7)

Select a handle where to install the bot

Select in which repo the bot shall be available

![setup6](https://github.com/ubiquity/ubiquibot/assets/41552663/dce6b338-abd8-4b54-b990-2cc6cf686d30)

After following the steps you should see

![setup7](https://github.com/ubiquity/ubiquibot/assets/41552663/bbcf0e40-456c-4dd4-93e4-75de87d4d340)


If you go again to localhost:3000 after the bot is installed on your handle you shall see

![ubiquity](https://github.com/ubiquity/ubiquibot/assets/41552663/f06250b9-1e3f-44c2-8ee8-efcf34baadd8)

Restart the server for the installation to take efect

![setup10](https://github.com/ubiquity/ubiquibot/assets/41552663/916cc5c3-dfdc-45c7-8d10-65afdce25e29)

After aforemoention steps then installation shall be complete

![setup11](https://github.com/ubiquity/ubiquibot/assets/41552663/0e88fec0-fa8b-4d34-8cc8-024c99b5b640)


**Note:** When setting up the project, please do not rename the `.env.example` file to `.env` as it will delete the environment example from the repository.
Instead, it is recommended to make a copy of the `.env.example` file and replace the values with the appropriate ones.

## Overview

- This bot is designed to exist as a GitHub Action.
- This bot is available as a GitHub Action.
- The code must be compiled using `@vercel/ncc` because all the dependencies (e.g. `node_modules`) must be included and committed on the repository for the GitHub Actions runner to use.

## How to use
Expand All @@ -54,40 +115,40 @@ To test the bot, you can:

1. Create a new issue
2. Add a time label, ex: `Time: <1 Day`
3. Add a priority label, ex: `Priority: 0 (Normal)`
3. Add a priority label, ex: `Priority: 1 (Normal)`
4. At this point the bot should add a price label.

## Configuration

`evm-network-id` is ID of the EVM-compatible network that will be used for payouts.
`evmNetworkId` is ID of the EVM-compatible network that will be used for payouts.

`price-multiplier` is a base number that will be used to calculate bounty price based on the following formula: `price = price-multiplier * time-label-weight * priority-label-weight * 100`
`priceMultiplier` is a base number that will be used to calculate bounty price based on the following formula: `price = priceMultiplier * timeLabelWeight * priority-label-weight * 100`

`time-labels` are labels for marking the time limit of the bounty:
`timeLabels` are labels for marking the time limit of the bounty:

- `name` is a human-readable name
- `value` is number of seconds that corresponds to the time limit of the bounty

`priority-labels` are labels for marking the priority of the bounty:
`priorityLabels` are labels for marking the priority of the bounty:

- `name` is a human-readable name

`command-settings` are setting to enable or disable a command
`commandSettings` are setting to enable or disable a command

- `name` is the name of the command
- `enabled` is a `true` or `false` value to enable or disable a command

`default-labels` are labels that are applied when an issue is created without any time or priority labels.
`defaultLabels` are labels that are applied when an issue is created without any time or priority labels.

`assistive-pricing` to create a new pricing label if it doesn't exist. Can be `true` or `false`.
`assistivePricing` to create a new pricing label if it doesn't exist. Can be `true` or `false`.

`disable-analytics` can be `true` or `false` that disables or enables weekly analytics collection by Ubiquity.
`disableAnalytics` can be `true` or `false` that disables or enables weekly analytics collection by Ubiquity.

`payment-permit-max-price` sets the max amount for automatic payout of bounties when the issue is closed.
`paymentPermitMaxPrice` sets the max amount for automatic payout of bounties when the issue is closed.

`comment-incentives` can be `true` or `false` that enable or disable comment incentives. These are payments generated for comments in the issue by contributors, excluding the assignee.
`commentIncentives` can be `true` or `false` that enable or disable comment incentives. These are payments generated for comments in the issue by contributors, excluding the assignee.

`issue-creator-multiplier` is a number that defines a base multiplier for calculating incentive for the creator of the issue.
`issueCreatorMultiplier` is a number that defines a base multiplier for calculating incentive for the creator of the issue.

`comment-element-pricing` defines how much is a part of the comment worth. For example `text: 0.1` means that any text in the comment will add 0.1

Expand All @@ -98,13 +159,16 @@ To test the bot, you can:
- `totals`:
- `word` defines reward for each word in the comment

`max-concurrent-assigns` is the maximum number of bounties that can be assigned to a bounty hunter at once. This excludes bounties with delayed or approved pull request reviews.
`maxConcurrentAssigns` is the maximum number of bounties that can be assigned to a bounty hunter at once. This excludes bounties with delayed or approved pull request reviews.

`register-wallet-with-verification` can be `true` or `false`. If enabled, it requires a signed message to set wallet address. This prevents users from setting wallet address from centralized exchanges, which would make payments impossible to claim.
`registerWalletWithVerification` can be `true` or `false`. If enabled, it requires a signed message to set wallet address. This prevents users from setting wallet address from centralized exchanges, which would make payments impossible to claim.

`promotion-comment` is a message that is appended to the payment permit comment.
`promotionComment` is a message that is appended to the payment permit comment.

## How to run locally
### Supase Database

### Option 1

1. Create a new project at [Supabase](https://supabase.com/). Add `Project URL` and `API Key` to the `.env` file:
molecula451 marked this conversation as resolved.
Show resolved Hide resolved

Expand All @@ -115,7 +179,25 @@ SUPABASE_KEY="XXX"

```

2. Create a new organization at [Memzo](https://app.mezmo.com/). Add `LOGDNA_INGESTION_KEY` to the `.env` file:
### Option 2
### This options will require you to have a local Docker installation (under the hood it is required by Supabase) refer to [Supabase Docs](https://supabase.com/docs)

```
yarn supabase start
```

## Check Supabase Status (locally)
```
yarn supabase status
```

![supabase](https://github.com/ubiquity/ubiquibot/assets/41552663/e8709b8f-e7c3-49e0-876c-c15dde22c6d2)



## Logs

2. Create a new organization at [Mezmo](https://app.mezmo.com/). Add `LOGDNA_INGESTION_KEY` to the `.env` file:
molecula451 marked this conversation as resolved.
Show resolved Hide resolved

```

Expand All @@ -132,7 +214,7 @@ DISQUALIFY_TIME="7 days" // 7 days

```

4. `yarn install`
4. `Make sure you have Node => 20 && yarn`
5. Open 2 terminal instances:
- in one instance run `yarn build --watch` (compiles the Typescript code)
- in another instance run `yarn start:watch` (runs the bot locally)
Expand All @@ -141,22 +223,24 @@ DISQUALIFY_TIME="7 days" // 7 days
At this point the `.env` files auto-fill the empty fields (`PRIVATE_KEY` and `APP_ID`) if it is not previously filled.
Now you can make changes to the repository on GitHub (e.g. add a bounty) and the bot should react.

7. After adding the bot (as a installed app) to your github you will need to restart the aforemention yarn start:watch so CTRL-C to stop the node daemon and `yarn start:watch` again

You can, for example:

1. Create a new issue
2. Add a time label, ex: `Time: <1 Day`
3. Add a priority label, ex: `Priority: 0 (Normal)`
4. At this point the bot should add a price label, you should see event logs in one of your opened terminals
3. Add a priority label, ex: `Priority: 1 (Normal)`
4. the bot should add a price label, you should see event logs in your opened bot terminals

## How it works

Bounty bot is built using the [probot](https://probot.github.io/) framework so initially the bot is a github app. But thanks to the [probot/adapter-github-actions](https://github.com/probot/adapter-github-actions) you can also use the bot as a github action.
Ubiquibot is built using the [probot](https://probot.github.io/) framework so in fact the bot is a github app. But thanks to the [probot/adapter-github-actions](https://github.com/probot/adapter-github-actions) you can also use the bot as a github action.

You can use the bounty bot as a [github app](https://github.com/marketplace/ubiquibot).
[Ubiquibot](https://github.com/marketplace/ubiquibot) it's also available ready to install on the Githut Marketplace.

When using as a github app the flow is the following:

1. Bounty bot is added to a repository as a github app
1. UbiquiBot is added to a repository as a github app
2. You run the bot "backend" (for example on your local machine)
3. Some event happens in a repository and the bot should react somehow (for example: on adding a time label to an issue the bot should add a price label)
4. Event details are sent to your deployed bot instance (to a webhook URL that was set in github app's settings)
Expand All @@ -180,7 +264,7 @@ For payment to work in your local instance, ubiquibot must be set up in a Github

## How to QA any additions to the bot

Make sure you have your local instance of ubiquibot running.
Make sure you have your local instance of [ubiquibot running](#quickstart).

1. Fork the ubiquibot repo and add your local instance of ubiquibot to the forked repository.
2. Enable Github action running on the forked repo and allow `issues` on the settings tab.
Expand All @@ -197,7 +281,7 @@ Make sure you have your local instance of ubiquibot running.

## Architecture Overview

Bounty bot is built using the [probot](https://probot.github.io/) framework so initially the bot is a github app
Ubiquibot is built using the [probot](https://probot.github.io/) framework, the bot is a github app

<pre>
&lt;root&gt;
Expand All @@ -221,6 +305,9 @@ Bounty bot is built using the [probot](https://probot.github.io/) framework so i
|
├── <a href="https://github.com/ubiquity/ubiquibot/tree/development/src/types">types</a> A set of schema and type definitions.<br> Why do we need schema? because we want to validate the unknown input and throw the error before the main execution.
|

├── <a href="https://github.com/ubiquity/ubiquibot/tree/development/src/helpers">helpers</a> A set of schema and type definitions.<br> Why do we need schema? because we want to validate the unknown input and throw the error before the main execution.

├── <a href="https://github.com/ubiquity/ubiquibot/tree/development/src/utils">utils</a> A set of utility functions
</pre>

Expand Down