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

Commit

Permalink
Merge branch 'development' into refactor/move-to-delegated-compute
Browse files Browse the repository at this point in the history
  • Loading branch information
gentlementlegen authored May 23, 2024
2 parents 7ac43a3 + 0fde755 commit fd291e2
Show file tree
Hide file tree
Showing 44 changed files with 1,156 additions and 20,169 deletions.
8 changes: 0 additions & 8 deletions .github/ubiquibot-config.yml

This file was deleted.

12 changes: 3 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,19 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Enable Corepack and Install Correct Yarn Version
run: |
corepack enable
yarn set version 4.0.2
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "20.10.0"
cache: "yarn"

- name: Install
run: yarn install
run: npm install -g bun && bun install

- name: Local Build
run: yarn build
run: bun tsc

- name: Lint
run: yarn format
run: bun format

run-migration:
runs-on: ubuntu-latest
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/conventional-commits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: Conventional Commits
on:
pull_request:
push:
branches: [development]

jobs:
conventional-commits:
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: "18.16.0"
node-version: "20.10.0"

- name: Install
run: yarn install
run: npm install bun -g && bun install

- name: Build
run: yarn build
run: bun tsc

- name: Test
env:
Expand Down Expand Up @@ -49,4 +49,4 @@ jobs:
WEBHOOK_SECRET: ${{ secrets.WEBHOOK_SECRET }}
X25519_PRIVATE_KEY: "QCDb30UHUkwJAGhLWC-R2N0PiEbd4vQY6qH2Wloybyo"

run: "yarn test"
run: "bun test"
30 changes: 30 additions & 0 deletions .github/workflows/knip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Knip

on:
pull_request:

permissions: write-all

jobs:
run-knip:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20.10.0

- name: Install toolchain
run: npm install -g bun && bun install

- name: Report knip results to pull request
uses: Codex-/knip-reporter@v2
with:
verbose: true
comment_id: ${{ github.workflow }}-reporter
command_script_name: knip-ci
annotations: true
ignore_results: false
2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn commitlint --edit "$1"
bun commitlint --edit "$1"
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
. "$(dirname "$0")/_/husky.sh"

# Run lint-staged first
yarn lint-staged --verbose
bun lint-staged --verbose
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v20.3.0
v20.10.0
7 changes: 0 additions & 7 deletions .vscode/settings.json

This file was deleted.

1 change: 0 additions & 1 deletion .yarnrc.yml

This file was deleted.

10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ We'd also love PRs. If you're thinking of a large PR, we advise opening up an is
## Submitting a pull request

1. Fork and clone the repository.
2. Configure and install the dependencies: `yarn install`.
3. Make sure the tests pass on your machine: `yarn test`. These tests also apply the linter, so there's no need to lint separately.
2. Configure and install the dependencies: `bun install`.
3. Make sure the tests pass on your machine: `bun test`. These tests also apply the linter, so there's no need to lint separately.
4. Create a new branch: `git checkout -b my-branch-name`.
5. Make your change, add tests, and make sure the tests still pass. You can find the tests in the `src/tests` directory.
6. Push to your fork and submit a pull request.
Expand All @@ -31,9 +31,9 @@ Work in Progress pull requests are also welcome to get feedback early on, or if
## Running the project locally

1. Fork and clone the repository.
2. Install dependencies: `yarn install`.
3. Build the project: `yarn build`.
4. Start the project: `yarn start:watch`.
2. Install dependencies: `bun install`.
3. Build the project: `bun tsc`.
4. Start the project: `bun start:watch`.

## Environment Setup

Expand Down
48 changes: 24 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ Ubiquity DAO's GitHub Bot for Automating DevPool Management.

git clone https://github.com/ubiquity/ubiquibot.git
cd ubiquibot
yarn
yarn build (to compile your changes)
bun
bun tsc (to compile your changes)

yarn build --watch (to locally auto compile your changes)
bun tsc --watch (to locally auto compile your changes)

yarn start:watch
bun start:watch

## It's recommended to split terminals in your IDE while running above input
```
Expand All @@ -51,7 +51,7 @@ 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_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.
Expand Down Expand Up @@ -101,7 +101,7 @@ If you are an external developer, `APP_ID`and `PRIVATE_KEY` are automatically ge

![trylocal](https://github.com/ubiquity/ubiquibot/assets/41552663/e958e7e4-6d42-44d1-a5cf-a090911f062c)

### Congratulations! you successfully installed Ubiquibot (new or to an existing app)
### Congratulations! you successfully installed UbiquiBot (new or to an existing app)


## Update an Existing Github App (bot)
Expand Down Expand Up @@ -153,7 +153,7 @@ Instead, it is recommended to make a copy of the `.env.example` file and replace

1. Go to the [UbiquiBot App Marketplace](https://github.com/marketplace/ubiquibot)
2. Choose a plan and install UbiquiBot on your repository
3. Congratulations! You can now use the UbiquiBot to manage your bounties.
3. Congratulations! You can now use the UbiquiBot to manage your tasks.

To test the bot, you can:

Expand All @@ -166,14 +166,14 @@ To test the bot, you can:

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

`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`
`priceMultiplier` is a base number that will be used to calculate task price based on the following formula: `price = priceMultiplier * timeLabelWeight * priority-label-weight * 100`

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

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

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

- `name` is a human-readable name

Expand All @@ -188,7 +188,7 @@ To test the bot, you can:

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

`paymentPermitMaxPrice` sets the max amount for automatic payout of bounties when the issue is closed.
`paymentPermitMaxPrice` sets the max amount for automatic payout of tasks when the issue is closed.

`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.

Expand All @@ -203,7 +203,7 @@ To test the bot, you can:
- `totals`:
- `word` defines reward for each word in the comment

`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.
`maxConcurrentAssigns` is the maximum number of tasks that can be assigned to a task hunter at once. This excludes tasks with delayed or approved pull request reviews.

`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.

Expand All @@ -228,12 +228,12 @@ Supabase comes with a [readme](https://github.com/ubiquity/ubiquibot/blob/develo
### 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
bun supabase start
```

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

![supabase](https://github.com/ubiquity/ubiquibot/assets/41552663/e8709b8f-e7c3-49e0-876c-c15dde22c6d2)
Expand All @@ -252,16 +252,16 @@ DISQUALIFY_TIME="7 days" // 7 days
```

3. `Make sure you have Node => 20 && yarn`
3. `Make sure you have Node => 20.10.0 && bun`
4. 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)
- in one instance run `bun tsc --watch` (compiles the Typescript code)
- in another instance run `bun start:watch` (runs the bot locally)
5. Open `http://localhost:3000` and follow instructions to add the bot to one of your repositories.

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.
Now you can make changes to the repository on GitHub (e.g. add a task) and the bot should react.

6. 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
6. After adding the bot (as a installed app) to your github you will need to restart the aforementioned `bun start:watch`` so CTRL-C to stop the node daemon and `bun start:watch` again

You can, for example:

Expand All @@ -272,9 +272,9 @@ You can, for example:

## How it works

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.
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.

[Ubiquibot](https://github.com/marketplace/ubiquibot) it's also available ready to install on the Githut Marketplace.
[UbiquiBot](https://github.com/marketplace/ubiquibot) it's also available ready to install on the GitHub Marketplace.

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

Expand Down Expand Up @@ -312,14 +312,14 @@ Make sure you have your local instance of [ubiquibot running](#quickstart).

## How to create a new release

1. Update the version in package.json: `yarn version --new-version x.x.x`
1. Update the version in package.json: `bun version --new-version x.x.x`
2. Commit and create a new tag: `git commit -am x.x.x && git tag -am x.x.x`
3. Push tags: `git push origin v"x.x.x"`
4. The Github action will create a release by recognizing the version tag

## Architecture Overview

Ubiquibot is built using the [probot](https://probot.github.io/) framework, 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 Down
Binary file added bun.lockb
Binary file not shown.
4 changes: 0 additions & 4 deletions knip.json

This file was deleted.

11 changes: 11 additions & 0 deletions knip.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type { KnipConfig } from "knip";

const config: KnipConfig = {
entry: ["src/index.ts"],
project: ["src/**/*.ts"],
ignore: ["src/types/config.ts"],
ignoreExportsUsedInFile: true,
ignoreDependencies: [],
};

export default config;
2 changes: 1 addition & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
ID = "d2668848-c2a6-411f-b884-004faee1942f"

[build]
command = "echo \"export const COMMIT_HASH = '$COMMIT_REF';\" > src/commit-hash.ts && yarn build"
command = "echo \"export const COMMIT_HASH = '$COMMIT_REF';\" > src/commit-hash.ts && bun tsc"
functions = "./.netlify/functions"
publish = "dist"

Expand Down
Loading

0 comments on commit fd291e2

Please sign in to comment.