Home > OS >  Read file from GH repository (Probot)
Read file from GH repository (Probot)

Time:04-20

I'm using Probot/Octocat to run some code checks, one of the things I'm doing is checking against a list of breaking changes in a separate repository on an internal package update. Is there any easy way to read a file (.md) from a separate private repository easily within Probot on a pull request action, or do I need a manual request?

CodePudding user response:

You can use Probot's Octokit instance to interact with GitHub API in an easy way.

Checking Octokit's API Docs, you can find here a way to get the content of a file:

context.octokit.rest.repos.getContent({
  owner,
  repo,
  path
});

I used Octokit's API for reading a file in this script if you want to check an example

  • Related