generated from ubiquity/ts-template
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from gentlementlegen/feat/configuration
chore: testing v2
- Loading branch information
Showing
45 changed files
with
2,907 additions
and
298 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Compute Rewards | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
stateId: | ||
description: "State Id" | ||
eventName: | ||
description: "Event Name" | ||
eventPayload: | ||
description: "Event Payload" | ||
settings: | ||
description: "Settings" | ||
authToken: | ||
description: "Auth Token" | ||
ref: | ||
description: "Ref" | ||
|
||
jobs: | ||
compute: | ||
name: Rewards | ||
runs-on: ubuntu-latest | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||
X25519_PRIVATE_KEY: ${{ secrets.X25519_PRIVATE_KEY }} | ||
SUPABASE_URL: ${{ secrets.SUPABASE_URL }} | ||
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }} | ||
NFT_MINTER_PRIVATE_KEY: ${{ secrets.NFT_MINTER_PRIVATE_KEY }} | ||
NFT_CONTRACT_ADDRESS: ${{ secrets.NFT_CONTRACT_ADDRESS }} | ||
EVM_PRIVATE_ENCRYPTED: ${{ secrets.EVM_PRIVATE_ENCRYPTED }} | ||
APP_ID: ${{ secrets.APP_ID }} | ||
UBIQUIBOT_APP_PRIVATE_KEY: ${{ secrets.UBIQUIBOT_APP_PRIVATE_KEY }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20.10.0" | ||
|
||
- name: Generate Rewards | ||
uses: ./ | ||
with: | ||
issueUrl: "${{ fromJSON(inputs.eventPayload).issue.html_url }}" | ||
evmPrivateEncrypted: "${{ secrets.EVM_PRIVATE_ENCRYPTED }}" | ||
evmNetworkId: "${{ fromJSON(inputs.settings).evmNetworkId }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,26 @@ | ||
import { Value } from "@sinclair/typebox/value"; | ||
import { baseIncentiveConfiguration, BotConfig, generateConfiguration } from "@ubiquibot/configuration"; | ||
import * as fs from "fs"; | ||
import YAML from "yaml"; | ||
import program from "../parser/command-line"; | ||
|
||
const file = fs.readFileSync(program.opts().config, "utf8"); | ||
const configuration = YAML.parse(file); | ||
let configuration: BotConfig; | ||
let incentivesConfiguration: BotConfig["incentives"] | null = null; | ||
try { | ||
const file = fs.readFileSync(program.opts().config, "utf8"); | ||
incentivesConfiguration = YAML.parse(file); | ||
} catch (e) { | ||
console.error(e); | ||
} | ||
|
||
// Get the default configuration | ||
configuration = generateConfiguration(); | ||
|
||
if (!Value.Check(baseIncentiveConfiguration, incentivesConfiguration)) { | ||
console.warn("Invalid bot configuration detected, will use defaults."); | ||
} else { | ||
// Merge the default with our own | ||
configuration = generateConfiguration({ ...configuration, incentives: incentivesConfiguration }); | ||
} | ||
|
||
export default configuration; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
import { config } from "dotenv"; | ||
|
||
config(); | ||
export const GITHUB_TOKEN = process.env.GITHUB_TOKEN; | ||
export const OPENAI_API_KEY = process.env.OPENAI_API_KEY; | ||
export const APP_ID = process.env.APP_ID; | ||
export const UBIQUIBOT_APP_PRIVATE_KEY = process.env.UBIQUIBOT_APP_PRIVATE_KEY; | ||
export const INSTALLATION_ID = process.env.INSTALLATION_ID; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.