I'm trying to write a static web page that will pull all the current pull requests in a github repo and display them. I would like to use octokit.js But that's for node.js. Is there a straightforward way to make authenticated calls to a github repo form a static webpage?
GitHub's API is very open. You can just fetch('https://api.github.com/repos/:user/:repo/pulls')
. https://developer.github.com/v3/pulls/#list-pull-requests
Do note that there is a limit on un-authenticated requests, but you shouldn't need to worry about that.
Run the example below to see a list of current pull requests against Node.js core.
fetch('https://api.github.com/repos/nodejs/node/pulls') .then((r) => r.json()) .then((pulls) => { pulls .map((p) => `[${p.number}] ${p.title} (${p.html_url})`) .forEach((s) => console.log(s)); });
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.