Public
Edited
Jun 13, 2023
Paused
57 forks
14 stars
Insert cell
Insert cell
repo = "observablehq/plot"
Insert cell
issues = fetchGithub(`/repos/${repo}/issues`, {per_page: 50})
Insert cell
Inputs.table(issues, {
layout: "auto",
columns: ["html_url", "title", "user", "comments", "created_at", "body"],
format: {
html_url: (html_url, i, data) => htl.html`<a href="${html_url}">${data[i].number}</a>`,
user: user => user.login,
created_at: created_at => d3.timeFormat("%x %X")(new Date(created_at)),
}
})
Insert cell
// toph work-in-progress
fetchGithub = async (path, params) => {
const response = (await fetch(
`https://api.github.com${path}?${new URLSearchParams(params)}`,
{headers: {
...(hasApiKey && {authorization: `token ${Secret("GITHUB_ACCESS_TOKEN")}`}),
accept: "application/vnd.github.v3+json"
}}
));
mutable rateLimit = {
remaining: +response.headers.get("X-RateLimit-Remaining"),
reset: new Date(response.headers.get("X-RateLimit-Reset") * 1000)
};
return response.json()
}
Insert cell
mutable rateLimit = null
Insert cell
hasApiKey = {
try {
Secret("GITHUB_ACCESS_TOKEN");
return true;
} catch {
return false;
}
}
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more