ubiquibot / comment-incentives

0 stars 10 forks source link

feat: save permits to db #33

Closed barebind closed 3 months ago

barebind commented 4 months ago

Resolves ubiquibot/conversation-rewards#13

barebind commented 4 months ago

@rndquu @pavlovcik

do you have any guides for testing ubiquibot PRs? I don't know how to test this.

0x4007 commented 4 months ago

do you have any guides for testing ubiquibot PRs? I don't know how to test this.

You'll need to create a GitHub App, install on your repos, and run it from local to test.

barebind commented 4 months ago

You'll need to create a GitHub App, install on your repos, and run it from local to test.

thanks! never tried before. will look for some tutorials later.

rndquu commented 4 months ago

@rndquu @pavlovcik

do you have any guides for testing ubiquibot PRs? I don't know how to test this.

As far as I understand, since https://github.com/ubiquity/ubiquibot/commit/b85d27ad6745fec080dd58becc4380138290acf0 is merged to the bot's development branch you need to:

  1. Setup your own bot's instance (i.e. github app), check readme https://github.com/ubiquity/ubiquibot
  2. Setup the bot's config with EVM private key
  3. Setup your own supabase instance for tests
  4. On permit generation (when github issue is closed as completed) somehow call your own instance of the comment-incentives plugin https://github.com/barebind/comment-incentives/tree/feature/save-permits-to-db to check that permits are saved to a DB
0x4007 commented 4 months ago
  1. On permit generation (when github issue is closed as completed) somehow call your own instance of the comment-incentives plugin https://github.com/barebind/comment-incentives/tree/feature/save-permits-to-db to check that permits are saved to a DB

Just need to change this line and it should work: https://github.com/ubiquity/ubiquibot/blob/development/src/handlers/comment/handlers/delegate-compute/delegated-compute.ts#L14

barebind commented 4 months ago

trying to get the bot up since yesterday but couldn't really manage.

my humble opinion is the process is complicated and probably some readmes are not up-to-date too. I gave up at this point. will try again some time later.

barebind commented 4 months ago

Just need to change this line and it should work:

couldn't really manage to come until this step but it seems like it retrieves the default branch no? should I make my feature branch default?

rndquu commented 4 months ago

trying to get the bot up since yesterday but couldn't really manage.

  • I cannot find the correct config file as the link here throws 404 error and default branch doesn't even have that .github/ubiquibot-config.yml file (hence 404).
  • I keep getting disabled command errors for all commands other than /help so basically cannot use any command
  • I commented out the disable command check seems like at least it gets the commands
  • but this time cannot add wallet because of the database schema issues as it throws value is out of range for type integer error for github userid

my humble opinion is the process is complicated and probably some readmes are not up-to-date too. I gave up at this point. will try again some time later.

Try to use this config https://github.com/rndquu-org/ubiquibot-config/blob/main/.github/ubiquibot-config.yml

rndquu commented 4 months ago

Just need to change this line and it should work:

couldn't really manage to come until this step but it seems like it retrieves the default branch no? should I make my feature branch default?

Just check that it works as expected with this PR, we'll QA it properly when the PR is ready

0x4007 commented 4 months ago

Just realized this isn't implemented yet.

Hope that you can rebase to latest and ensure that the view claim button works!

https://github.com/ubiquity/pay.ubq.fi/pull/190#issuecomment-1986987767

barebind commented 3 months ago

Try to use this config https://github.com/rndquu-org/ubiquibot-config/blob/main/.github/ubiquibot-config.yml

tried this too but doesn't work. still getting disabled command and also 'no evm priv key' error, which is actually there. also config schema doesn't match with the one @rndquu sent.

I don't think ubiquibot works out-of-box on local environment for testing purposes following the guides. we can hold this pr back until somehow find a way to test it.

0x4007 commented 3 months ago

Here's our org config now


keys:
  evmPrivateEncrypted: A3_ALEuhyNzvhgu7oH0qCyG59WTsP7NCmOGZ651cd0FKRl8Zd1bQMsciJU0WAXhAAQaWUGUArDygtwrTDF_VF_peS6Sqgv-j1f5doUeZUdAMsp9qddd4eggFR0pMbAtFOjf2FM5Ckwz2bztzJYDnrg

features:
  assistivePricing: true
  newContributorGreeting:
    enabled: true
  publicAccessControl:
    setLabel: true
    fundExternalClosedIssue: true

payments:
  evmNetworkId: 100
  basePriceMultiplier: 2
  issueCreatorMultiplier: 3
  maxPermitPrice: 1000

timers:
  reviewDelayTolerance: 30 days
  taskStaleTimeoutDuration: 30 days
  taskFollowUpDuration: 3.5 days
  taskDisqualifyDuration: 7 days

miscellaneous:
  promotionComment: "<h6>If you've enjoyed your experience in the DevPool, we'd appreciate your support. Follow <a href='https://github.com/ubiquity'>Ubiquity on GitHub</a> and star <a href='https://github.com/ubiquity/devpool-directory'>this repo</a>. Your endorsement means the world to us and helps us grow!</h6><h6>We are excited to announce that the DevPool and UbiquiBot are now available to partners! Our ideal collaborators are globally distributed crypto-native organizations, who actively work on open source on GitHub, and excel in research & development. If you can introduce us to the repository maintainers in these types of companies, we have a special bonus in store for you!</h6>"
  maxConcurrentTasks: 2
  registerWalletWithVerification: false

disabledCommands: []

incentives:
  comment:
    elements:
      code: 1
      img: 0
      h1: 1
      h2: 1
      h3: 1
      h4: 1
      h5: 1
      h6: 1
      li: 0.5
      a: 1
      blockquote: 0
      i: 0
    totals:
      word: 0.1

labels:
  time:
    - "Time: <1 Hour"
    - "Time: <2 Hours"
    - "Time: <4 Hours"
    - "Time: <1 Day"
    - "Time: <1 Week"
  priority:
    - "Priority: 1 (Normal)"
    - "Priority: 2 (Medium)"
    - "Priority: 3 (High)"
    - "Priority: 4 (Urgent)"
    - "Priority: 5 (Emergency)"
barebind commented 3 months ago

new config works well. thank you @pavlovcik

I can at least run commands on the bot, but after that there was some errors about db schema and permissions too.

now I get 404 not found error which I have no idea why.

name: 'HttpError',
status: 404,
response: { 
  url: 'https://api.github.com/repos/barebind/comment-incentives/actions/workflows/compute.yml/dispatches', 
  status: 404, 
  headers: {...}, 
  data: { message: 'Not Found', documentation_url: 'https://docs.github.com/rest/actions/workflows#create-a-workflow-dispatch-event' } }

any ideas?

0x4007 commented 3 months ago

I want to drop locations table. I wonder if it's easier to handle that in a separate task.

Also try a manual run maybe the dispatches doesn't exist until at least it was run once. Otherwise check that compute.yml is there cause it says it's missing.

barebind commented 3 months ago

I think I've solved 404 issue.

now I get Error: OPENAI_API_KEY not set error from comment-incentives. where does it read the environment variables? I've tried to add it through settings/environments but didn't really work.

and one more question actually, should comment-incentives/.github/ubiquibot-config.yml and ubiquibot-config/.github/ubiquibot-config.yml match?

it doesn't right now as the evmPrivateEncrypted is different.

rndquu commented 3 months ago

now I get Error: OPENAI_API_KEY not set error from comment-incentives. where does it read the environment variables? I've tried to add it through settings/environments but didn't really work.

As far as I understand you're trying to run the bot from your own branch of https://github.com/ubiquibot/comment-incentives so you need to set OPENAI_API_KEY in github secrets

and one more question actually, should comment-incentives/.github/ubiquibot-config.yml and ubiquibot-config/.github/ubiquibot-config.yml match?

it doesn't right now as the evmPrivateEncrypted is different.

It seems both of the configs (one, two) have the same schema + evmPrivateEncrypted has the same key name and value so I don't see what's different

0x4007 commented 3 months ago

and one more question actually, should comment-incentives/.github/ubiquibot-config.yml and ubiquibot-config/.github/ubiquibot-config.yml match?

No they have nothing to do with each other.

Its a bit meta but let me explain: the first one is just the config for when people are working on our code. So its our real settings our bot reads from right now when people work on this repository. You should not change that file because we won't accept the pull if you modify it.

The other one is for your organization, for if you want to set up tasks and have people contribute.

barebind commented 3 months ago

I've had some problems with \ns on apps private key when adding on github secrets. (solved)

I've checked that it works with @pavlovcik 's supabase instance.

0x4007 commented 3 months ago

I've checked that it works with @pavlovcik 's supabase instance.

I don't see it

Screenshot 2024-03-12 at 15 13 10
barebind commented 3 months ago

I don't see it

it's the one with the id 10. that's my test case.

rndquu commented 3 months ago

Closing this one, related comment