ubiquibot / plugin-template

Template repository for plugins that will run within Ubiquibot.
0 stars 3 forks source link

@ubiquibot/plugin-template

Prerequisites

Getting Started

  1. Create a new repository using this template.
  2. Clone the repository to your local machine.
  3. Install the dependencies preferably using yarn or bun.

Creating a new plugin

  1. Ensure you understand and have setup the kernel.
  2. Update compute.yml with your plugin's name and update the id.
  3. Update context.ts with the events that your plugin will fire on.
  4. Update plugin-inputs.ts to match the with: settings in your org or repo level configuration.
- plugin: <plugin-org/owner>/<plugin-repo-name>:compute.yml@development
  name: plugin-name
  id: plugin-name-command
  description: "Plugin description" # small description of what the plugin does
  command: "<regex for command>" # if you are creating a plugin with a slash command
  example: "<example usage>" # how to invoke the slash command
  with: # these are the example settings, the kernel passes these to the plugin.
    disabledCommands: []
    timers:
      reviewDelayTolerance: 86000
      taskStaleTimeoutDuration: 2580000
    miscellaneous:
      maxConcurrentTasks: 3
    labels:
      time: []
      priority: []
At this stage, your plugin will fire on your defined events with the required settings passed in from the kernel. You can now start writing your plugin's logic.
  1. Start building your plugin by adding your logic to the plugin.ts file.

Testing a plugin

Worker Plugins

await fetch("http://localhost:4000/", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    stateId: "",
    eventName: "",
    eventPayload: "",
    settings: "",
    ref: "",
    authToken: "",
  }),
});

A full example can be found here.

Action Plugins

Nektos Act - a tool for running GitHub Actions locally.

More information

Examples