Skip to content

Instantly share code, notes, and snippets.

@pmarques
Last active June 16, 2019 13:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pmarques/9ba18817a074c93194ce362b159349d5 to your computer and use it in GitHub Desktop.
Save pmarques/9ba18817a074c93194ce362b159349d5 to your computer and use it in GitHub Desktop.
Fetch file from private github repo
const Octokit = require('@octokit/rest')
const octokit = new Octokit({
auth: "<my github access token",
userAgent: "pmarques 1.0" // tried with and without
})
octokit.repos.getContents({
"owner": "ansible",
"repo": "ansible",
"path": "README.rst",
"ref": "devel"
})
.then( (data) => {
console.log("data")
})
.catch( (err) => {
console.log(err)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment