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

Proposal: Extensible Incentives #792

Closed
0x4007 opened this issue Sep 21, 2023 · 5 comments
Closed

Proposal: Extensible Incentives #792

0x4007 opened this issue Sep 21, 2023 · 5 comments

Comments

@0x4007
Copy link
Member

0x4007 commented Sep 21, 2023

  • Perhaps partner projects may want to create their own routines or incentives that can piggyback off of the bot, instead of building a whole new bot.
  • The inspiration behind this is that I wanted to make a direct incentive for Draeieg to complete QA, and, for example, get paid 100 WXDAI per successful QA test. But I don't want this to be part of the bot's core code. Also its only applicable in the UbiquiBot repo.

What if by leveraging the repo/org config, we let partners add custom logic?

  • I'm not sure if reentrancy style attacks are viable in TypeScript due to function scopes but I suggest that the custom logic should exist as a TypeScript module (like export default a single function) inside of their repo's .github folder.
    • For example, using a custom handler in one organization can post a payment permit in another organization (unlikely to be possible given that each Netlify runtime instance is isolated)
  • in the config, they can define
    • custom /commands and then associate a handler by writing the filepath to the module.
    • custom event handlers, meaning they can associate arbitrary GitHub events to a custom handler they can load in during runtime.
    • There should also be a way to define a wildcard custom handler as well. We can have a special slot in the config, and then when the bot completes its wildcard actions across that repo, it can pick up and run that last bit of logic.
    • we need to be strict with time limits so that they dont bust our netlify runtime with a timeout and high costs.
    • we need to sanitize the data that goes in and out of these "external" functions
    • this can certainly be a premium feature we would charge for.

Examples

I never wrote a handler so I'm not totally up to speed on the architecture, but we can expose some seemingly essential and harmless objects to the handler. I'm also unsure what the return value should be.

// import { getBotConfig, getBotContext, getLogger } from "../../bindings";
// import { addCommentToIssue, getUserPermission, removeLabel, addLabelToIssue } from "../../helpers";

export default function myCustomHandler(bindings, helpers) {
    const context = bindings.getBotContext();
    const logger = bindings.getLogger();
}
@0x4007
Copy link
Member Author

0x4007 commented Jan 31, 2024

@0x4007 0x4007 closed this as not planned Won't fix, can't repro, duplicate, stale Jan 31, 2024
Copy link

ubiquibot bot commented Jan 31, 2024

! action has an uncaught error

Copy link

ubiquibot bot commented Jan 31, 2024

# Issue was not closed as completed. Skipping.

Copy link

ubiquibot bot commented Jan 31, 2024

! action has an uncaught error

Copy link

ubiquibot bot commented Jan 31, 2024

! action has an uncaught error

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant