Skip to content

Commit

Permalink
Merge pull request #170 from gentlementlegen/feat/local-run
Browse files Browse the repository at this point in the history
feat: migration to SDK
  • Loading branch information
gentlementlegen authored Nov 7, 2024
2 parents 878a348 + 369058f commit 11d9092
Show file tree
Hide file tree
Showing 59 changed files with 1,460 additions and 11,147 deletions.
33 changes: 30 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,8 +1,35 @@
# Token used to use when calling GitHub API
GITHUB_TOKEN="<token>"

# Key for OpenAI usage
OPENAI_API_KEY="<api_key>"
# treasury fee applied to the final permits, ex: 100 = 100%, 0.1 = 0.1%

# Supabase URL
SUPABASE_URL=""

# Supabase key
SUPABASE_KEY=""

# X25519 private key
X25519_PRIVATE_KEY=""

# NFT minter private key
NFT_MINTER_PRIVATE_KEY=""

# NFT contract address
NFT_CONTRACT_ADDRESS=""

# Treasury fee applied to the final permits, ex: 100 = 100%, 0.1 = 0.1%
PERMIT_FEE_RATE=""
# github account associated with EVM treasury address allowed to claim permit fees, ex: "ubiquity-os-treasury"

# GitHub account associated with EVM treasury address allowed to claim permit fees, ex: "ubiquity-os-treasury"
PERMIT_TREASURY_GITHUB_USERNAME=""
# comma separated list of token addresses which should not incur any fees, ex: "0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d, 0x4ECaBa5870353805a9F068101A40E0f32ed605C6"

# Comma-separated list of token addresses which should not incur any fees, ex: "0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d, 0x4ECaBa5870353805a9F068101A40E0f32ed605C6"
PERMIT_ERC20_TOKENS_NO_FEE_WHITELIST=""

# Optional kernel public key
KERNEL_PUBLIC_KEY=""

# Logger level, default is INFO
LOG_LEVEL=""
2 changes: 2 additions & 0 deletions .github/workflows/compute.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PLUGIN_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
X25519_PRIVATE_KEY: ${{ secrets.X25519_PRIVATE_KEY }}
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
Expand All @@ -35,6 +36,7 @@ jobs:
PERMIT_FEE_RATE: ${{ secrets.PERMIT_FEE_RATE }}
PERMIT_TREASURY_GITHUB_USERNAME: ${{ secrets.PERMIT_TREASURY_GITHUB_USERNAME }}
PERMIT_ERC20_TOKENS_NO_FEE_WHITELIST: ${{ secrets.PERMIT_ERC20_TOKENS_NO_FEE_WHITELIST }}
KERNEL_PUBLIC_KEY: ${{ secrets.KERNEL_PUBLIC_KEY }}

steps:
# Note: the checkout could potentially be avoided by calling the workflow on the repo/branch directly.
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/jest-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@ jobs:
with:
fetch-depth: 0

- uses: oven-sh/setup-bun@v2

- name: Jest With Coverage
run: yarn install --immutable --immutable-cache --check-cache && yarn test
# we install with bun but test with Jest because bun doesn't support network mocking yet
run: bun install && yarn test

- name: Add Jest Report to Summary
if: always()
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/knip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ jobs:
with:
node-version: 20.10.0

- name: Setup Bun
uses: oven-sh/setup-bun@v2

- name: Install toolchain
run: yarn install
run: bun install

- name: Store PR number
run: echo ${{ github.event.number }} > pr-number.txt
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/update-configuration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:

steps:
- uses: ubiquity-os/action-deploy-plugin@main
with:
treatAsEsm: true
env:
APP_ID: ${{ secrets.APP_ID }}
APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ static/dist
junit.xml
coverage
test-dashboard.md
*.private.env.json
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
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn lint-staged
bun lint-staged
11 changes: 2 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
# `@ubiquity-os/text-conversation-rewards`

As of 28 February: test driven development to aggregate all necessary information based on a URL to an issue.

- pass in closed as complete issue URL and receive all the timeline events and activities of all humans who helped close the issue as complete.
- most importantly: this can inherit bot authentication and link pull requests to issues in private repositories.

Be sure to review all `*.test.*` files for implementation details.

## Data structure

```json
Expand Down Expand Up @@ -354,8 +347,8 @@ Partner private key (`evmPrivateEncrypted` config param in `conversation-rewards

Here `GITHUB_OWNER_ID` can be:

1. Github organization id (if ubiquity-os is used within an organization)
2. Github user id (if ubiquity-os is simply installed in a user's repository)
1. GitHub organization id (if ubiquity-os is used within an organization)
2. GitHub user id (if ubiquity-os is simply installed in a user's repository)

Format `PRIVATE_KEY:GITHUB_OWNER_ID` restricts in which particular organization (or user related repositories)
this private key can be used. It can be set either in the organization wide config either in the repository wide one.
Expand Down
8 changes: 3 additions & 5 deletions dist/33.index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
exports.id = 33;
exports.ids = [33];
exports.modules = {
export const id = 33;
export const ids = [33];
export const modules = {

/***/ 57666:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
Expand Down Expand Up @@ -28,7 +28,6 @@ module.exports = globalThis.DOMException
/***/ 42033:
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";

// EXPORTS
__webpack_require__.d(__webpack_exports__, {
Expand Down Expand Up @@ -147,4 +146,3 @@ async function fileFromPath(path, filenameOrOptions, options) {
/***/ })

};
;
150 changes: 150 additions & 0 deletions dist/422.index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 33 additions & 22 deletions dist/index.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/index.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions dist/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "module"
}
1 change: 1 addition & 0 deletions dist/sourcemap-register.cjs

Large diffs are not rendered by default.

12 changes: 11 additions & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ import type { Config } from "jest";

const cfg: Config = {
transform: {
"^.+\\.tsx?$": "babel-jest",
"^.+\\.tsx?$": [
"ts-jest",
{
useESM: true,
},
],
},
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
coveragePathIgnorePatterns: ["node_modules", "mocks"],
Expand All @@ -12,6 +17,11 @@ const cfg: Config = {
coverageDirectory: "coverage",
testTimeout: 20000,
roots: ["<rootDir>", "tests"],
extensionsToTreatAsEsm: [".ts"],
moduleNameMapper: {
"^(\\.{1,2}/.*)\\.js$": "$1",
},
setupFilesAfterEnv: ["dotenv/config"],
};

export default cfg;
2 changes: 1 addition & 1 deletion knip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const config: KnipConfig = {
project: ["src/**/*.ts"],
ignore: ["src/data-collection/examples/*.ts", "src/configuration/common-config-type.ts", "dist/**"],
ignoreExportsUsedInFile: true,
ignoreDependencies: ["ts-node", "msw", "@mswjs/data"],
ignoreDependencies: ["ts-node", "msw", "@mswjs/data", "@octokit/plugin-paginate-graphql"],
jest: {
config: ["jest.config.ts"],
entry: ["src/**/*.test.ts"],
Expand Down
Loading

0 comments on commit 11d9092

Please sign in to comment.