Public
Edited
Jan 31, 2024
4 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
latest_commit_hash = {
if (!fetchLatestCommit) {
return;
}
if (!resolved) {
return;
}
const url = `https://api.github.com/repos/${resolved}/commits`;
const data = await (await fetch(url)).json();
return data[0].sha;
}
Insert cell
url = {
if (!branch || !resolved) {
return null;
}
if (branch == "main" || branch == "master") {
return `https://codeload.github.com/${resolved}/zip/refs/heads/${branch}`;
}
return `https://codeload.github.com/${resolved}/zip/${branch}`;
}
Insert cell
resolved = {
const simpleRepoRegex = /^[^\/]+\/[^\/]+$/;
if (simpleRepoRegex.test(repo)) {
return repo;
}

// Extract 'owner/repo' from a GitHub URL
const urlRegex = /https:\/\/github\.com\/([^\/]+\/[^\/]+)/;
const match = repo.match(urlRegex);

return match ? match[1] : null;
}
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more