INNER CODE UNIT · JavaScript
resolveGithubLogin
metacontroller/metacontroller · release.config.js:10
async function resolveGithubLogin(commit) {
const cacheKey = commit.author.email;
if (githubLoginCache.has(cacheKey)) return githubLoginCache.get(cacheKey);
let login = null;
try {
const res = await fetch(
`https://api.github.com/repos/metacontroller/metacontroller/commits/${commit.hash}`,
{ headers: { Authorization: `Bearer ${process.env.GH_TOKEN}` } }
);
if (res.ok) {
const data = await res.json();
login = data.author?.login ?? null;
}
} catch {
// network/API hiccup - fall back to git author name below
}