0

比如我当前仓库有五个分支,它们的名字分别是:master、branch1、branch2、branch3、branch4。使用用于 probot 构建的 typescript 语言来获取这些名称。

我试过的:

import { Application } from 'probot' 
export = (app: Application) => {
  app.on(`*`, async context => {
    var branchName = context.github.repos.listBranches.name
    var branchName1 = context.github.repos.getBranch.name
    var branchName2 = context.payload.Status.branches.name
    console.log(branchName + "\n")
    // result: bound apiMethod
    console.log(branchName1 + "\n")
    // result: bound apiMethod
    console.log(branchName2 + "\n")
    // result: ERROR event: Cannot read property 'branches' of undefined
  })
}

请解释一下bound apiMethod这里的意思。

谢谢!

4

1 回答 1

0
const myRepoID = context.repo({number: context.payload.repository.id})
await context.github.repos.listBranches(myRepoID)
于 2019-03-18T14:27:27.587 回答