Skip to content

Module augmentation of Context.octokit.git #1489

Answered by gr2m
ghost asked this question in Q&A
Discussion options

You must be logged in to vote

You can extend Octokit using plugins

import { ProbotOctokit } from 'probot'

export async function createBranch(octokit: ProbotOctokit)  {
  return {
    async createBranch(string) {
      // your code here, use the `octokit` instance
      return true
    }
  }
}

Then you can pass your own Octokit constructor, depending on how you are running your app. If you use a long living process, you can use the Server export

import { Server, Probot, ProbotOctokit } from "probot";
import { createBranch } from "./create-branch-plugin.js";
import { app } from "./index.js"

async function startServer() {
  const server = new Server({
    Probot: createProbot({
      Octokit: ProbotOctokit.plugin(crea…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant